Exemplo n.º 1
0
        public void TestAddFood(Order order)
        {
            List <Menu>     menus     = menuBLL.ListMenu();
            List <MenuItem> menuItems = menuItemBLL.FindByMenuID(menus[1]);

            List <OrderDetail> listOrderDetail = new List <OrderDetail>();

            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = order.ID,
                MenuItemID = menuItems[0].ID,
                Price      = menuItems[0].Price,
                Quantity   = 10
            });
            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = order.ID,
                MenuItemID = menuItems[1].ID,
                Price      = menuItems[1].Price,
                Quantity   = 20
            });
            listOrderDetail.Add(new OrderDetail
            {
                OrderID    = order.ID,
                MenuItemID = menuItems[2].ID,
                Price      = menuItems[2].Price,
                Quantity   = 30
            });
            orderBLL.AddFood(order, listOrderDetail);

            TestAddVAT(order);
        }
Exemplo n.º 2
0
        private void btnOrder_Click(object sender, EventArgs e)
        {
            List <OrderDetail> listOrderDetail = new List <OrderDetail>();

            List <SelectMenuItemControl> listControls = this.flowLayoutPanelRight.Controls.OfType <SelectMenuItemControl>().ToList();

            foreach (SelectMenuItemControl c in listControls)
            {
                if (c.OrderDetail != null)
                {
                    continue;
                }

                listOrderDetail.Add(new OrderDetail
                {
                    OrderID    = this.order != null ? this.order.ID : 0,
                    MenuItemID = c.MenuItem.ID,
                    Price      = c.MenuItem.Price,
                    Quantity   = c.Quantity
                });
            }

            OrderBLL orderBLL = new OrderBLL();

            if (this.order == null)
            {
                //create order
                orderBLL.CreateOrder(GlobalData.EMPLOYEE, this.Tables, this.txtCustomerName.Text, listOrderDetail);
            }
            else
            {
                // add food
                orderBLL.AddFood(this.order, listOrderDetail);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }