//log-out
        private void main_Button_Exit_Click(object sender, EventArgs e)
        {
            FormLoginMenu logInPage = new FormLoginMenu();

            logInPage.Show();
            this.Hide();
        }
Пример #2
0
        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 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);
            }
        }
Пример #4
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();
        }
Пример #5
0
        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 = "";
        }
Пример #7
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();
        }
Пример #10
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);
        }
Пример #11
0
        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);
            }
        }
Пример #13
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();
        }
Пример #14
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();
 }
Пример #15
0
        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();
        }
Пример #16
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();
            }
        }
Пример #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;
            }
        }
Пример #18
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;
                }
            }
        }
Пример #19
0
 // timer restart when form is activated
 private void FormAddItem_Activated(object sender, EventArgs e)
 {
     FormLoginMenu.timeToDuel();
     FormLoginMenu.timeToReduel();
 }
Пример #20
0
 // stop the timer when the form closes
 private void FormFrontPage_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormLoginMenu.timeToNotDuel();
 }
Пример #21
0
 private void FormPayment_Activated(object sender, EventArgs e)
 {
     // start the timer when form loads
     convertToCash();
     FormLoginMenu.timeToReduel();
 }
 private void FormTableLayoutDineIn_FormClosing(object sender, FormClosingEventArgs e)
 {
     // stop the timer on form change
     FormLoginMenu.timeToNotDuel();
 }
Пример #23
0
 private void btnFinalizePrint_FormOrderPage_Click_1(object sender, EventArgs e)
 {
     FormLoginMenu.getBackStack().Push(formPayment);
     formPayment.Show();
     this.Hide();
 }
 private void FormTableLayoutDineIn_Activated(object sender, EventArgs e)
 {
     // start the timer when form loads
     FormLoginMenu.timeToReduel();
 }
Пример #25
0
 private void FormOrderPage_Activated(object sender, EventArgs e)
 {
     // start the timer when form loads
     FormLoginMenu.timeToReduel();
 }
Пример #26
0
 // stop timer on form change
 private void FormAddItem_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormLoginMenu.timeToNotDuel();
 }
Пример #27
0
 // restarts the timer when the page is shown
 private void FormFrontPage_Activated(object sender, EventArgs e)
 {
     // timer reset on form show
     FormLoginMenu.timeToNotDuel();
     FormLoginMenu.timeToReduel();
 }
Пример #28
0
 private void FormPayment_FormClosing(object sender, FormClosingEventArgs e)
 {
     // stop timer on form change
     FormLoginMenu.timeToNotDuel();
 }
Пример #29
0
 private void FormOrderPage_FormClosing(object sender, FormClosingEventArgs e)
 {
     // stops the timer on form change
     FormLoginMenu.timeToNotDuel();
 }
 //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();
 }