Exemplo n.º 1
0
        public void AddOrderItemToExistingOrder(string nameOfItem)
        {
            var addOrderItem  = new Order_MenuItemTableAdapter();
            var menuItemTable = new MenuItemTableAdapter();
            var menuItemDT    = menuItemTable.GetData();
            int menuItemID    = 1;

            foreach (dsDinerMax3000.MenuItemRow row in menuItemDT.Rows)
            {
                if (row.Name.ToLower() == nameOfItem.ToLower())
                {
                    menuItemID = row.Id;
                }
            }

            addOrderItem.InsertOrderItem(_databaseID, menuItemID);
        }
        public static List<Order> GetAllOrders()
        {
            OrderTableAdapter taOrder = new OrderTableAdapter();
            Order_MenuItemTableAdapter taOrder_MenuItem = new Order_MenuItemTableAdapter();
            MenuItemTableAdapter taMenuItem = new MenuItemTableAdapter();

            var dtOrder = taOrder.GetData();
            List<Order> allOrders = new List<Order>();

            foreach (dsDinerMax3000.OrderRow orderRow in dtOrder.Rows)
            {
                Order CurrentOrder = new Order();
                CurrentOrder._OrderNumber = orderRow.OrderNumber;
                CurrentOrder._databaseID = orderRow.ID;
                allOrders.Add(CurrentOrder);

                var dtOrderItems = taMenuItem.GetMenuItemsByOrderID(orderRow.ID);
                foreach(dsDinerMax3000.MenuItemRow menuItemRow in dtOrderItems.Rows){
                    CurrentOrder.AddMenuItem (menuItemRow.Name, menuItemRow.Description, menuItemRow.Price);
                }
            }

            return allOrders;
        }
 public void AddMenuItemToOrder(int OrderID, int MenuItemID)
 {
     Order_MenuItemTableAdapter taOrder_MenuItem = new Order_MenuItemTableAdapter();
     taOrder_MenuItem.Insert(OrderID, MenuItemID);
 }