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();
        }
Exemple #2
0
        private void resetBackToTableForm()
        {
            FormFrontPage.finalizeBill = false;

            //pop FormPayment
            FormLoginMenu.getBackStack().Peek().Hide();
            FormLoginMenu.getBackStack().Pop();

            //Reset FormOrder
            FormOrderPage   orderForm;
            FormTableLayout tableLayout;

            orderForm = (FormOrderPage)FormLoginMenu.getBackStack().Peek();
            orderForm.resetFormOrderPage();

            //Reset current table
            FormLoginMenu.getBackStack().Pop();
            tableLayout = (FormTableLayout)FormLoginMenu.getBackStack().Peek();
            // tableLayout.Show();
            tableLayout.changeOrderImage();
            tableLayout.resetTable();

            //Pop to front page
            FormLoginMenu.getBackStack().Pop();
            FormFrontPage frontPage = (FormFrontPage)FormLoginMenu.getBackStack().Peek();

            frontPage.Show();
        }
        private void order10_Click(object sender, EventArgs e)
        {
            updateCurrentTable(9);

            if (FormFrontPage.dineIn || FormFrontPage.checkIn)
            {
                nextPage10.CreateTabbedPanel();
                nextPage10.AddProductsToTabbedPanel();
                nextPage10.Show();
                this.Hide();

                FormLoginMenu.getBackStack().Push(nextPage10);
            }
            else if (FormFrontPage.finalizeBill)
            {
                FormLoginMenu.getBackStack().Push(nextPage10);
                FormLoginMenu.getBackStack().Push(paymentPage10);

                paymentPage10.Show();
                this.Hide();
            }
            else
            {
                tableSelectionError(4);
            }
        }
        private void addItem_Button_Cancel_Click(object sender, EventArgs e)
        {
            //how back function:
            FormLoginMenu.getBackStack().Pop().Hide();
            FormLoginMenu.getBackStack().Peek().Show();

            resetButtonToGreen();
        }
        private void addItem_Button_Cancel_Click_1(object sender, EventArgs e)
        {
            //how back function:
            FormLoginMenu.getBackStack().Pop().Hide();
            FormLoginMenu.getBackStack().Peek().Show();

            txtQuanity_editQuantity.Text = "";
        }
Exemple #6
0
        /*
         * From tableLayout to orderPage, click back to back to tableLayout
         * From frontPage to orderPage, click back to back to frontPage
         */

        private void btnBack_FormOrderPage_Click(object sender, EventArgs e)
        {
            //how back function:
            FormLoginMenu.getBackStack().Pop().Hide();
            FormLoginMenu.getBackStack().Peek().Show();

            tbControlItems.Controls.Clear();

            textBox_search.Text = "";
        }
        private void logout()
        {
            // empty the back stack
            while (FormLoginMenu.getBackStack().Count > 1)
            {
                FormLoginMenu.getBackStack().Pop();
            }

            FormLoginMenu.getBackStack().Peek().Show();
            this.Hide();
        }
        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();
        }
Exemple #9
0
        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 main_Button_DineIn_Click(object sender, EventArgs e)
        {
            reserved     = false;
            checkIn      = false;
            finalizeBill = false;
            takeout      = false;

            tableLayout.changeOrderImage();
            tableLayout.setClearBtnbool(true);
            tableLayout.Show();
            this.Hide();

            dineIn = true;

            FormLoginMenu.getBackStack().Push(tableLayout);
        }
        private void btnOrder1_receipt_tableLayout_Click(object sender, EventArgs e)
        {
            updateCurrentTable(0);

            if (FormFrontPage.finalizeBill)
            {
                FormLoginMenu.getBackStack().Push(nextPage10);
                FormLoginMenu.getBackStack().Push(paymentPage10);

                paymentPage1.Show();
                this.Hide();
            }
            else
            {
                tableSelectionError(4);
            }
        }
Exemple #12
0
        private void resetBackToFrontPage()
        {
            //pop FormPayment
            FormLoginMenu.getBackStack().Peek().Hide();
            FormLoginMenu.getBackStack().Pop();

            //Reset FormOrder
            FormOrderPage orderForm;

            orderForm = (FormOrderPage)FormLoginMenu.getBackStack().Peek();
            orderForm.resetFormOrderPage();

            //Pop to front page
            FormLoginMenu.getBackStack().Pop();
            FormFrontPage frontPage = (FormFrontPage)FormLoginMenu.getBackStack().Peek();

            frontPage.Show();
        }
Exemple #13
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (FormFrontPage.finalizeBill)
     {
         FormLoginMenu.getBackStack().Pop().Hide();
         FormLoginMenu.getBackStack().Pop().Hide();
         FormLoginMenu.getBackStack().Peek().Show();
     }
     else
     {
         FormLoginMenu.getBackStack().Pop().Hide();
         FormLoginMenu.getBackStack().Peek().Show();
     }
     products.Clear();
     givenAmount = 0;
     txbCashGiven.Clear();
     txbChange.Clear();
 }
        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();
        }
Exemple #15
0
        private void quantity_formOrderPage_Click(object sender, EventArgs e)
        {
            if (products.Count != 0)
            {
                selectedProduct = (tblProduct)listBoxOrderItems.SelectedItem;
                FormLoginMenu.getBackStack().Push(editQuan);
                editQuan.ShowDialog();

                listBoxOrderItems.Refresh();
            }

            else
            {
                FormError errorBox = new FormError();
                errorBox.changeTitle      = "Error";
                errorBox.changeLabel.Text = "Nothing to edit quantity!";
                errorBox.changeButtonTwo.Hide();
                errorBox.ShowDialog();
            }
        }
Exemple #16
0
        private void btnCredit_Click(object sender, EventArgs e)
        {
            if (txb_CardHolder.Text == "" || txbCardNumber.Text == "" || txbCCV.Text == "")
            {
                errorMessage(3);
                return;
            }
            else
            {
                if (txbCardNumber.Text.Length < 12)
                {
                    txbCardNumber.Clear();
                    txbCCV.Clear();
                    errorMessage(4);
                }

                else if (txbCCV.Text.Length < 3)
                {
                    txbCardNumber.Clear();
                    txbCCV.Clear();
                    errorMessage(5);
                }

                else
                {
                    saveTransaction();

                    FormReceipt nextPage = new FormReceipt();
                    FormLoginMenu.getBackStack().Push(nextPage);
                    nextPage.ShowDialog();


                    givenAmount = 0;
                }
            }
        }
Exemple #17
0
        private void btnPayCash_Click(object sender, EventArgs e)
        {
            if (txbCashGiven.Text == "")
            {
                errorMessage(0);
                return;
            }
            else
            {
                convertToCash();
                saveTransaction();
                if (givenAmount >= calculateTotal())
                {
                    txbChange.Text = string.Format("{0:c}", calculateChange());

                    FormReceipt nextPage = new FormReceipt();
                    FormLoginMenu.getBackStack().Push(nextPage);
                    nextPage.ShowDialog();
                }


                givenAmount = 0;
            }
        }
Exemple #18
0
 public FormReceipt()
 {
     InitializeComponent();
     FormLoginMenu.getBackStack().Pop();
 }
 //back to the Main menu page:
 private void Back_button_Click(object sender, EventArgs e)
 {
     //how back function:
     FormLoginMenu.getBackStack().Pop().Hide();
     FormLoginMenu.getBackStack().Peek().Show();
 }
Exemple #20
0
 private void btnFinalizePrint_FormOrderPage_Click_1(object sender, EventArgs e)
 {
     FormLoginMenu.getBackStack().Push(formPayment);
     formPayment.Show();
     this.Hide();
 }