public void RefreshView() { Menu.Clear(); Clients.Clear(); ActiveOrders.Clear(); CompletedOrders.Clear(); ActiveDelivery.Clear(); CompletedDeliveries.Clear(); foreach (DishDTG dish in restaurantManager.GetMenu()) { Menu.Add(new DishModel(dish)); } foreach (ClientDTG client in restaurantManager.GetAllClients()) { Clients.Add(new ClientModel(client)); } foreach (OrderDTG order in restaurantManager.GetActiveOrders()) { ActiveOrders.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetCompletedOrders()) { CompletedOrders.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetActiveDeliveries()) { ActiveDelivery.Add(new OrderModel(order)); } foreach (OrderDTG order in restaurantManager.GetCompletedDeliveries()) { CompletedDeliveries.Add(new OrderModel(order)); } }
public void RefreshView() { Menu.Clear(); Clients.Clear(); ActiveOrders.Clear(); CompletedOrders.Clear(); ActiveDelivery.Clear(); CompletedDeliveries.Clear(); foreach (Dish dish in restaurantManager.GetMenu()) { Menu.Add(dish); } foreach (Client client in restaurantManager.GetAllClients()) { Clients.Add(client); } foreach (Order order in restaurantManager.GetActiveOrders()) { ActiveOrders.Add(order); } foreach (Order order in restaurantManager.GetCompletedOrders()) { CompletedOrders.Add(order); } foreach (Order order in restaurantManager.GetActiveDeliveries()) { ActiveDelivery.Add(order); } foreach (Order order in restaurantManager.GetCompletedDeliveries()) { CompletedDeliveries.Add(order); } }
void AddOrder(OrderData od) { LineCount++; lock (olock) { List <OrderData> lstOrdData = Orders.Select(a => a).Where(b => b.ORD_NO == od.ORD_NO).ToList(); List <OrderData> lstCompOrdData = CompletedOrders.Select(a => a).Where(b => b.ORD_NO == od.ORD_NO).ToList(); OrderData tmpod = null; if (lstOrdData.Count > 0) { tmpod = lstOrdData[0]; } else if (lstCompOrdData.Count > 0) { tmpod = lstCompOrdData[0]; } foreach (var o in lstOrdData) { LineCount--; Orders.Remove(o); } foreach (var c in lstCompOrdData) { LineCount--; CompletedOrders.Remove(c); } //OrderDatabase.SaveItem(new Order(od)); if (tmpod != null && tmpod.Status == OrderStatus.Delivered) { tmpod.status = status.Completed; tmpod.IsSelected = true; CompletedOrders.Add(tmpod); if (tmpod.OnSelectionChanged == null) { tmpod.OnSelectionChanged = new OrderData.cmdFireOnSelected(UploadOrderData); } } else if (tmpod != null && tmpod.Status == OrderStatus.Shipped) { tmpod.status = status.Completed; tmpod.IsSelected = false; Orders.Add(tmpod); if (tmpod.OnSelectionChanged == null) { tmpod.OnSelectionChanged = new OrderData.cmdFireOnSelected(UploadOrderData); } } else //add to orders - new item { if (od.Status == OrderStatus.Shipped) { od.status = status.Completed; od.IsSelected = false; Orders.Add(od); } else if (od.Status == OrderStatus.Delivered) { od.status = status.Completed; od.IsSelected = true; CompletedOrders.Add(od); } else { od.status = status.Completed; // od.Status = OrderStatus.Shipped; od.IsSelected = false; Orders.Add(od); } if (dShippedRequestPending.Contains(od.ORD_NO)) { dShippedRequestPending.Remove(od.ORD_NO); } if (dDeliveredRequestPending.Contains(od.ORD_NO)) { dDeliveredRequestPending.Remove(od.ORD_NO); } if (od.OnSelectionChanged == null) { od.OnSelectionChanged = new OrderData.cmdFireOnSelected(UploadOrderData); } } } }