private void btn_add_FormAddItem_Click(object sender, EventArgs e) { if (productList.Count > 0) { Stack <Form> tempStack = new Stack <Form>(); tempStack.Push(FormLoginMenu.getBackStack().Peek()); FormLoginMenu.getBackStack().Pop(); FormOrderPage orderPage = (FormOrderPage)FormLoginMenu.getBackStack().Peek(); FormLoginMenu.getBackStack().Push(tempStack.Peek()); tempStack.Pop(); resetButtonToGreen(); //Add items to FormOrderPage.products so that they can be displayed on orderList for (int i = 0; i < productList.Count; i++) { orderPage.products.Add(productList.ElementAt(i)); } productList.Clear(); } FormLoginMenu.getBackStack().Pop().Hide(); FormLoginMenu.getBackStack().Peek().Show(); }
private void copyProduct() { FormOrderPage orderPage = getFormOrder(); if (orderPage.products.Count > 0) { foreach (tblProduct product in orderPage.products.ToList()) { products.Add(product); } } }
private void addItem_Button_Item_Next_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtQuanity_editQuantity.Text) && FormOrderPage.selectedProduct != null) { Stack <Form> tempStack = new Stack <Form>(); tempStack.Push(FormLoginMenu.getBackStack().Peek()); FormLoginMenu.getBackStack().Pop(); FormOrderPage orderPage = (FormOrderPage)FormLoginMenu.getBackStack().Peek(); FormLoginMenu.getBackStack().Push(tempStack.Peek()); tempStack.Pop(); int num = int.Parse(txtQuanity_editQuantity.Text); for (int i = 0; i < num; i++) { tblProduct addProduct = FormOrderPage.selectedProduct; productList.Add(addProduct); } foreach (tblProduct prod in orderPage.products.ToList()) { if (prod.Description == FormOrderPage.selectedProduct.Description) { orderPage.products.Remove(prod); } } for (int i = 0; i < productList.Count; i++) { orderPage.products.Add(productList.ElementAt(i)); } orderPage.subTotalTextChanged(); productList.Clear(); } //done -> reset everything back: FormOrderPage.selectedProduct = new tblProduct(); txtQuanity_editQuantity.Clear(); FormLoginMenu.getBackStack().Pop().Hide(); FormLoginMenu.getBackStack().Peek().Show(); }
private FormOrderPage getFormOrder() { Stack <Form> tempStack = new Stack <Form>(); tempStack.Push(FormLoginMenu.getBackStack().Peek()); FormLoginMenu.getBackStack().Pop(); FormOrderPage orderPage = (FormOrderPage)FormLoginMenu.getBackStack().Peek(); FormLoginMenu.getBackStack().Push(tempStack.Peek()); tempStack.Pop(); return(orderPage); }
private void btnTakeOut_FormFrontPage_Click(object sender, EventArgs e) { reserved = false; dineIn = false; finalizeBill = false; takeout = true; FormOrderPage order = new FormOrderPage(); FormLoginMenu.getBackStack().Push(order); order.CreateTabbedPanel(); order.AddProductsToTabbedPanel(); order.Show(); this.Hide(); }
/* * Clear button is to reset everything * set every tables to empty (0s) * set every tables back to color GREEN */ private void CLEAR_Click(object sender, EventArgs e) { bool empty = true; if (FormFrontPage.finalizeBill) { FormFrontPage.finalizeBill = false; changeOrderImage(); } for (int i = 0; i < tables.Length; i++) { if (tables[i] != 0) { empty = false; } } if (!empty) { FormError confirmDialog = new FormError(); confirmDialog.changeLabel.Text = "Are you sure to clear all?\n"; confirmDialog.changeTitle = "Confirm Delete"; confirmDialog.changeButtonTwo.Text = "Cancel"; confirmDialog.ShowDialog(); if (FormError.getClickResult_FormError()) { for (int i = 0; i < tables.Length; i++) //reset for empty tables: { if (tables[i] != 0) { tables[i] = 0; if (i == 0) { nextPage1 = new FormOrderPage(); } else if (i == 1) { nextPage2 = new FormOrderPage(); } else if (i == 2) { nextPage3 = new FormOrderPage(); } else if (i == 3) { nextPage4 = new FormOrderPage(); } else if (i == 4) { nextPage5 = new FormOrderPage(); } else if (i == 5) { nextPage6 = new FormOrderPage(); } else if (i == 6) { nextPage7 = new FormOrderPage(); } else if (i == 7) { nextPage8 = new FormOrderPage(); } else if (i == 8) { nextPage9 = new FormOrderPage(); } else if (i == 9) { nextPage10 = new FormOrderPage(); } } } foreach (Control myControl in panelTable.Controls) { if (myControl is Button) { myControl.BackColor = Color.Green; } if (myControl is PictureBox) { myControl.Hide(); } } } } else { FormError confirmDialog = new FormError(); confirmDialog.changeLabel.Text = "All tables/rooms are empty\n"; confirmDialog.changeTitle = "OK."; confirmDialog.changeButtonTwo.Hide(); confirmDialog.ShowDialog(); } }