Example #1
0
        //this functions add a section(sub category) to the menu list
        //this will show a title and number of menu lines
        private void AddMenuSectionToUI(List <ChapeauMenuItem> menuItems, string title)
        {
            Label label = new Label();

            label.Text = title;
            label.Font = titleFont;
            flowLayoutPanelMenuItems.Controls.Add(label);


            foreach (ChapeauMenuItem item in menuItems)
            {
                int       quantity = currentOrder.GetQuantity(item.itemID);
                OrderItem i        = new OrderItem()
                {
                    name          = item.name,
                    price         = item.price,
                    itemID        = item.itemID,
                    quantity      = quantity,
                    stockQuantity = item.stockQuantity
                };
                MenuViewLine menuViewLine = new MenuViewLine(i, this);
                flowLayoutPanelMenuItems.Controls.Add(menuViewLine);
            }
        }
Example #2
0
        public void ShowOrderDetails(Order order)
        {
            isOrdersList = false;
            currentOrder = order;
            //
            order_service.currentOrder = order;
            OrderDetails_menuStrip.Show();
            //this will show me the overview of orders.
            flowLayoutPanelMenuItems.Controls.Clear();
            Label label = new Label();

            label.Width = 300;
            label.Text  = "Table " + currentOrder.table;
            label.Font  = titleFont;
            flowLayoutPanelMenuItems.Controls.Add(label);

            if (currentOrder.state == Status.Pending || currentOrder.state == Status.Processing || currentOrder.state == Status.Ready)
            {
                //Retrieve all orders from the the model, and show it in the flowlayoutpanel
                foreach (OrderItem item in currentOrder.OrderItems)
                {
                    if (item.quantity != 0)
                    {
                        MenuViewLine menuViewLine = new MenuViewLine(item, this);
                        // We are creating a line for the order details section:
                        // We want these menu view lines to be removed when clicking "X", so mark them
                        menuViewLine.MarkedForClear = true;
                        flowLayoutPanelMenuItems.Controls.Add(menuViewLine);
                    }
                }

                Button btnSendOrder = new Button();
                btnSendOrder.Text = "Send Order";
                flowLayoutPanelMenuItems.Controls.Add(btnSendOrder);
                btnSendOrder.Click += BtnSendOrder_Click;

                Button btnPay = new Button();
                btnPay.Text = "Pay";
                flowLayoutPanelMenuItems.Controls.Add(btnPay);
                btnPay.Click += btnPay_Click;
            }
            else
            {
                Label emptylabel = new Label();
                emptylabel.Text      = "order is " + currentOrder.state.ToString();
                emptylabel.Width     = 300;
                emptylabel.Height    = 50;
                emptylabel.TextAlign = ContentAlignment.MiddleLeft;
                flowLayoutPanelMenuItems.Controls.Add(emptylabel);

                Button newOrder_btn = new Button();
                newOrder_btn.Text = "new order";
                flowLayoutPanelMenuItems.Controls.Add(newOrder_btn);
                newOrder_btn.Click += newOrder_btn_Click;
            }
            if (currentOrder.state == Status.Empty)
            {
                Button occupy_btn = new Button();
                occupy_btn.Text = "occupied";
                flowLayoutPanelMenuItems.Controls.Add(occupy_btn);
                occupy_btn.Click += occupy_btn_Click;
            }
            else if (currentOrder.state == Status.Occupied)
            {
                Button free_btn = new Button();
                free_btn.Text = "free table";
                flowLayoutPanelMenuItems.Controls.Add(free_btn);
                free_btn.Click += free_btn_Click;
            }
        }