//Handler for when the save button is clicked. private void btn_Save(object sender, EventArgs e) { if (!GlobalVar.CURRENT_ORDER.editable) { MessageBox.Show("This order has already been saved. Please start a new order.", "Error: Order Already Complete"); return; } //If there is no order to save, do not save the order. //If payment has not completed, do not save the order. //If payment is insufficient, do not save the order. if (!GlobalVar.CURRENT_ORDER.paymentComplete) { MessageBox.Show("Please complete payment before attempting to finalize the order.", "Error: Payment Not Received"); return; } GetMasterInfo mst = new GetMasterInfo(); //Send it to a function that saves the order to the database. mst.SaveNewOrder(GlobalVar.CURRENT_ORDER); GlobalVar.FOCUS_ITEM = null; GlobalVar.DISCOUNT = false; GlobalVar.CURRENT_ORDER = new Order(); Image newPaymentType = new Bitmap(@"..\..\Resources\Cash.jpg"); btnPayment.BackgroundImage = newPaymentType; clearScreen(true); }
private void frmMain_Load(object sender, EventArgs e) { GetMasterInfo mst = new GetMasterInfo(); txItemName.Font = new Font("Algerian", 26, FontStyle.Bold); this.WindowState = FormWindowState.Maximized; mst.loadItemList(); getOrderGridView(); //orderList.DataSource = getOrderGridView(); initMstBtn(); }
//Handler for when the back order button is clicked. private void btn_BackOrder(object sender, EventArgs e) { runSound(); //Since there could be a selected row in the orderlist, the handler for the orderlist is disabled for this method. orderList.SelectionChanged -= this.btn_OrderListClick; GetMasterInfo mst = new GetMasterInfo(); GlobalVar.CURRENT_ORDER = mst.RetrieveOrder(GlobalVar.CURRENT_ORDER.now, this.orderList, true); clearScreen(true); orderList = copyToOrderList(GlobalVar.CURRENT_ORDER.orderList, orderList); orderList.SelectionChanged += this.btn_OrderListClick; }