Esempio n. 1
0
        /// <summary>
        /// Load all order lists
        /// </summary>
        public async void LoadLists()
        {
            PrioritizedOrders.Clear();
            OrdersWaiting.Clear();

            // Getting all items from the database
            DatabaseList = await rep.GetOrderByStatus(0);

            // Setting it to the UI list
            OrdersReadyToCook = await ViewModelhelpers.FillListFromDatabase <BackendHandler.Order, OrderViewModel>(DatabaseList);

            FillWaitingLists();
        }
Esempio n. 2
0
        /// <summary>
        /// Method to fill the waiting lists
        /// The six first orders will be shown in the main boxes.
        /// If it's more than 6 orders the rest will be put to another list.
        /// </summary>
        public void FillWaitingLists()
        {
            // Fills up the the different waiting lists
            foreach (var order in OrdersReadyToCook)
            {
                for (int i = 0; i < OrdersReadyToCook.Count; i++)
                {
                    // Adds the six longest-waiting order to show fully
                    if (PrioritizedOrders.Count < 6 && order == OrdersReadyToCook[i] && order.PizzaList.Count > 0)
                    {
                        PrioritizedOrders.Add(order);
                    }

                    // Adds the rest to the waiting list
                    else if (PrioritizedOrders.Count >= 6 && order == OrdersReadyToCook[i] && order.PizzaList.Count > 0)
                    {
                        OrdersWaiting.Add(order);
                    }
                }
            }
        }