Пример #1
0
        private void Btn_FinishOrder_Click(object sender, RoutedEventArgs e)
        {
            var ord = Dg_ProcessingOrders.SelectedItem as Order;

            bool removeFromProcessingList = true;

            foreach (var food in ord.OrderedFoods)
            {
                if (!food.ServedStatus)
                {
                    removeFromProcessingList = false;
                }
            }

            if (removeFromProcessingList)
            {
                ordersInProcessingList.Remove(ord);
                App.ordersCompletedList.Add(ord);
                OrdersInKitchenWindow.UpdateFoodsServed(ord);

                Dg_ProcessingOrders.ItemsSource = ordersInProcessingList;
                Dg_CompletedOrders.ItemsSource  = App.ordersCompletedList;

                MyStorage.WriteXML <ObservableCollection <Order> >("ordersInProcessing.xml", ordersInProcessingList);
                MyStorage.WriteXML <ObservableCollection <Order> >("ordersCompleted.xml", App.ordersCompletedList);
            }
            else
            {
                MessageBox.Show("There are still orders to be served");
            }
        }
Пример #2
0
        private void Btn_Click_SendOrderKitchen(object sender, RoutedEventArgs e)
        {
            bool orderInKitchen = false;

            if (order.OrderedFoods.Count() > 0)
            {
                foreach (var item in ordersInProcessingList)
                {
                    if (item.OrderId == order.OrderId)
                    {
                        foreach (var food in order.OrderedFoods)
                        {
                            var lst = item.OrderedFoods.Where(S => S.FoodId == food.FoodId)
                                      .Select(S => { S.Quantity = food.Quantity; S.TotalPrice = food.TotalPrice; return(S); }).ToList();
                            if (lst == null)
                            {
                                item.OrderedFoods.Add(food);
                            }
                        }

                        orderInKitchen = true;
                        break;
                    }
                }

                if (!orderInKitchen)
                {
                    ordersInProcessingList.Add(order);
                }

                MyStorage.WriteXML <ObservableCollection <Order> >("ordersInProcessing.xml", ordersInProcessingList);
                OrdersInKitchenWindow.UpdateFoodsServed(order);

                order = null;
                Sp_CurrentOrderDetails.DataContext = null;
                Dg_OrderedFoods.ItemsSource        = null;
                Dg_ProcessingOrders.ItemsSource    = ordersInProcessingList;
                CoBx_TableNo.SelectedItem          = null;

                Sp_EditOrderDetails.Visibility = Visibility.Hidden;
                TBl_EditNoOrders.Visibility    = Visibility.Hidden;
                TBl_EditViewOrders.Visibility  = Visibility.Visible;

                totalPrice = 0.0;
                SetTotalPrice();

                MessageBox.Show("Order is sent to Kitchen");

                EnableDisableComponents();
            }
            else
            {
                MessageBox.Show("No Food is selected to place order!!");
            }
        }
Пример #3
0
        public OrdersInKitchenWindow()
        {
            InitializeComponent();

            Instance    = this;
            kitchenlist = MyStorage.ReadXML <ObservableCollection <Order> >("ordersInProcessing.xml");
            if (kitchenlist == null)
            {
                kitchenlist = new ObservableCollection <Order>();
            }
        }
Пример #4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            categories          = MyStorage.GetEmbeddedXML <ObservableCollection <Category> >("Data.foods.xml");
            ordersCompletedList = MyStorage.ReadXML <ObservableCollection <Order> >("ordersCompleted.xml");

            if (ordersCompletedList == null)
            {
                ordersCompletedList = new ObservableCollection <Order>();
            }

            tables = new ObservableCollection <string> {
                "Table01", "Table02", "Table03", "Table04", "Table05"
            };

            TakeOrdersWindow takeOrdersWindow = new TakeOrdersWindow();

            takeOrdersWindow.Show();

            OrdersInKitchenWindow ordersInKitchenWindow = new OrdersInKitchenWindow();

            ordersInKitchenWindow.Show();
        }