示例#1
0
        internal static void updateOrdersUsingFileData(OrderList orderslist, string[] dataLines, Menu menu)
        {
            foreach (string line in dataLines)
            {
                string[]    data       = line.Split(',');
                List <Item> orderItems = Utility.BuildOrderItemsList(data[2], menu);
                DateTime    date       = DateTime.Parse(data[1]);
                Order       order      = new Order(Int32.Parse(data[0]), date, orderItems);

                orderslist.AddOrderToList(order);
            }
        }
示例#2
0
        internal static bool AddNewOrder(bool enoughProducts, List <Item> orderItems, IDictionary <int, int> productCount, List <Product> productList, OrderList orders, int id)
        {
            if (enoughProducts == false)
            {
                return(false);
            }

            foreach (Product allProd in productList)
            {
                foreach (KeyValuePair <int, int> pair in productCount)
                {
                    if (allProd.id == pair.Key)
                    {
                        allProd.portionCount -= pair.Value;
                    }
                }
            }
            orders.AddOrderToList(new Order(id, orderItems));
            return(true);
        }