예제 #1
0
        private void GoBackToManagerStartMenu()
        {
            IMenu nextMenu;

            Console.WriteLine("Going back, ZOOM");
            nextMenu = new ManagerStartMenu(CurrentManager, ref Repo);
            MenuManager.Instance.ReadyNextMenu(nextMenu);
        }
        public override void ExecuteUserChoice()
        {
            LocationOrders = LocationService.GetAllOrdersForLocation(currentManager.Location);

            List <Order> sortedOrderList    = new List <Order>(LocationOrders.Count);
            bool         IsSortOrderForward = false;


            IMenu previousMenu = new ManagerStartMenu(currentManager, ref Repo);

            switch (selectedChoice)
            {
            case 1:
                sortedOrderList = LocationOrders.OrderBy(o => o.Subtotal).ToList();
                OrderHistoryUtility.ProcessSortingByDate(ref IsSortOrderForward);

                break;

            case 2:
                sortedOrderList = LocationOrders.OrderBy(o => o.TimeOrderWasPlaced).ToList();
                OrderHistoryUtility.ProcessSortingByPrice(ref IsSortOrderForward);
                break;

            case 3:
                Console.WriteLine("Going back.");

                MenuManager.Instance.ReadyNextMenu(previousMenu);
                return;

            //break;
            default:
                sortedOrderList = null;
                throw new NotImplementedException();
                //break;
            }

            try
            {
                IOrderService orderService = new OrderService(ref Repo);
                OrderHistoryUtility.ShowOrderHistory(ref sortedOrderList, ref orderService, IsSortOrderForward);
            }
            catch (NullReferenceException e)
            {
                Console.WriteLine("No orders were found for this location. Cry about it, I suppose.");
                Log.Error(e.Message);
            }

            Console.WriteLine("Really interesting list, right?");


            MenuManager.Instance.ReadyNextMenu(previousMenu);
        }