private void bPay_Click(object sender, EventArgs e)
DB.Instance.Insert("order", new Parameter("customer_id", cid), new Parameter("dt", DateTime.Now), new Parameter("status", OrderStatus.New));
uint oid = 0;
using (MySqlDataReader reader = DB.Instance.SelectReader("select max(id) from order"))
if(reader != null && reader.Read()){
oid = reader.GetUInt32(0);
foreach (var item in Role.Instance.ShopCart)
DB.Instance.Insert("order_inventory", new Parameter("order_id", oid), new Parameter("inventory_id", item.ID), new Parameter("amount", item.Qty));
var dr = MessageBox.Show("Order Placed. Would you like to pay now?", "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
new Payment().ShowDialog();
else if(dr == DialogResult.No)
var ppd = new PrintPreviewDialog();
PrintDocument pd = new PrintDocument();
ppd.Document = pd;
pd.PrintPage += Pd_PrintPage;
ppd.ShowDialog();
}
public static void PrintOrder()
var doc = new PrintDocument();
doc.PrinterSettings.PrinterName = System.Configuration.ConfigurationManager.AppSettings["PrinterName"];
doc.PrintPage += new PrintPageEventHandler(PrintPage);
doc.Print();
}
public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
Debug.Assert(dc == null && graphics == null, "PrintController methods called in the wrong order?");
// For security purposes, don't assume our public methods methods are called in any particular order
CheckSecurity(document);
base.OnStartPrint(document, e);
// the win32 methods below SuppressUnmanagedCodeAttributes so assertin on UnmanagedCodePermission is redundant
if (!document.PrinterSettings.IsValid)
throw new InvalidPrinterException(document.PrinterSettings);
dc = document.PrinterSettings.CreateDeviceContext(modeHandle);
SafeNativeMethods.DOCINFO info = new SafeNativeMethods.DOCINFO();
info.lpszDocName = document.DocumentName;
if (document.PrinterSettings.PrintToFile)
info.lpszOutput = document.PrinterSettings.OutputPort; //This will be "FILE:"
info.lpszOutput = null;
info.lpszDatatype = null;
info.fwType = 0;
int result = SafeNativeMethods.StartDoc(new HandleRef(this.dc, dc.Hdc), info);
if (result <= 0) {
int error = Marshal.GetLastWin32Error();
if (error == SafeNativeMethods.ERROR_CANCELLED) {
e.Cancel = true;
else {
throw new Win32Exception(error);
}
/* Events to execute when the "Print" button is clicked */
private void Print_button_Click(object sender, EventArgs e)
/* Creates a new instance of printDocument, appends the result from PrintDocumentOnPrintPage and prints the result */
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += PrintDocumentOnPrintPage;
printDocument.Print();
}
private void axWindowsMediaPlayer1_PlayStateChange(object sender, _WMPOCXEvents_PlayStateChangeEvent e)
//QUANDO VIDEO FOR PARADO
if ( axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPaused )
//O VIDEO FOI PARADO, PARA CONTINUAR PRECISA CLICAR EM OK
if ( MessageBox.Show("Video Parado. Clique aqui para continuar!", "",
MessageBoxButtons.OK , MessageBoxIcon.Information) == DialogResult.OK )
axWindowsMediaPlayer1.Ctlcontrols.play();
//QUANDO O VIDEO ACABAR
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
//IMPRIME
PrintDocument document = new PrintDocument();
document.PrintPage += new PrintPageEventHandler(impressaoConf);
document.Print();
this.Hide();
}