Ejemplo n.º 1
0
        //Completes the payment, checkout
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            //Price * count + VAT calculation is happening here
            order.TotalCost = order.CalculateTotalPrice() + os.CalculateVAT(order);

            //If the input is not a number, it goes as 0 to the DB
            if (!System.Text.RegularExpressions.Regex.IsMatch(txtBoxTip.Text, @"^-?(([1-9]\d*)|0)(.0*[1-9](0*[1-9])*)?$"))
            {
                order.Tip = 0;
            }
            else
            {
                order.Tip = decimal.Parse(txtBoxTip.Text);
            }

            //Saves the comment
            order.Feedback = txtBoxComment.Text;

            os.CompleteOrder(order);

            //Shows Payment was successfull message
            MessageBox.Show("Payment was succesfully completed.", "Payment Succesful!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Overview overview = new Overview(employee);

            overview.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void btn_cancel_Click(object sender, EventArgs e)
        {
            Overview overview = new Overview(employee);

            overview.Show();
            this.Close();
        }
        private void navitem_overview_Click(object sender, EventArgs e)
        {
            Overview overview = new Overview(employee);

            overview.Show();

            this.Close();
        }
        /*
         * Our design makes use of a back button
         * 'back' is not only from categories items to menu parent, but also from 'ordered items' to the last visitted panel.
         * This is why we make use of integers. the current panel index gets saved to 'panelIndex', so when the back button is clicked
         * We can do '--panelIndex' to go back to the last page.
         */
        private void ShowCorrectPanel(int panelIndex)
        {
            flowLayoutPanelMenu.Hide();
            flowLayoutPanelMenuCategorie.Hide();
            flowLayoutPanelMenuItem.Hide();
            flowLayoutPanelOrderedItems.Hide();
            lbl_item_name.Hide();
            lbl_price.Hide();
            lbl_stock.Hide();

            if (panelIndex == 0)
            {
                Overview overview = new Overview(employee);
                overview.Show();

                this.Close();
            }
            else if (panelIndex == 1)
            {
                flowLayoutPanelMenu.Show();
            }
            else if (panelIndex == 2)
            {
                flowLayoutPanelMenuCategorie.Show();
                flowLayoutPanelMenuItem.Show();
                lbl_item_name.Show();
                lbl_price.Show();
                lbl_stock.Show();
            }
            else if (panelIndex == 3)
            {
                flowLayoutPanelMenuCategorie.Show();
                flowLayoutPanelOrderedItems.Show();
                flowLayoutPanelOrderedItems.BringToFront();
            }

            this.panelIndex = panelIndex;
        }
        private void SubmitOrder()
        {
            try
            {
                // Add the order
                order_service.AddOrder(table, employee, orderedItemsList);
                // Reset inpute values
                ResetInputValues();
                // Remove active states
                RemoveActiveMenuCardState();
                // Clear order list
                ClearOrderList();
                // Reset currentMenuItem
                currentMenuItem = null;

                MessageBox.Show(
                    "Order is succefully placed", // Exception Message
                    "Order succefull",            // Message box caption (title)
                    MessageBoxButtons.OK,         // Close button that return an exit code of '0'.
                    MessageBoxIcon.Information    // Message box theme.
                    );

                Overview overview = new Overview(employee);
                overview.Show();

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ex.Message,                    // Exception Message
                    "Adding order process error.", // Message box caption (title)
                    MessageBoxButtons.OK,          // Close button that return an exit code of '0'.
                    MessageBoxIcon.Error           // Message box theme.
                    );
            }
        }