public override void Display()
        {
            Console.Clear();
            DisplayHeader();
            string date = Input.GetDate("Enter the date of a file to edit orders from that date: ");

            SetTestOrProd.MyOrderObject.LoadOrderFile(date);
            Screen next = new HomeScreen();

            if (!WorkingMemory.OrderList.Any())
            {
                Console.Write("There are no orders for that date. Press 1 to try\nanother date or enter to return to main menu. ");
                string input = Console.ReadLine();
                if (input == "1")
                {
                    next = new EditOrderScreen();
                }
                Screen.JumpScreen(next);
            }
            Output.DisplayAllOrders();

            int   orderNumber    = Input.GetOrderNumber("Enter an order number to edit: ");
            var   myTestVariable = WorkingMemory.OrderList;
            Order order;

            if (orderNumber <= WorkingMemory.OrderList.Count)
            {
                var oldOrder = WorkingMemory.OrderList.FirstOrDefault(o => o.OrderNumber == orderNumber);
                order = ChangeOrder.EditEntireOrder(oldOrder);
                var index = WorkingMemory.OrderList.IndexOf(oldOrder);
                WorkingMemory.OrderList[index] = order;
                Console.Clear();
                Output.DisplaySingleOrder(order);
            }

            var doCommit = Input.QueryForCommit();

            ChangeOrder.CommitChangesToFile(doCommit);
            Output.DisplayCommitResults(doCommit);

            Screen.JumpScreen(next);
        }
Exemple #2
0
        public override void Display()
        {
            Console.Clear();
            DisplayHeader();
            string date = Input.GetDate("Enter the date of the file to remove orders from that date: ");

            SetTestOrProd.MyOrderObject.LoadOrderFile(date);

            RejectEmptyDate();
            Console.WriteLine("\nALL ORDERS FOR {0}:", date);
            Console.WriteLine();
            Output.DisplayAllOrders();

            int orderNumber    = Input.GetInteger("Enter the order number to delete: ");
            var myTestVariable = WorkingMemory.OrderList;

            if (orderNumber <= WorkingMemory.OrderList.Count)
            {
                var order = from o in WorkingMemory.OrderList.ToList()
                            where o.OrderNumber == orderNumber
                            select o;
                foreach (var k in order)
                {
                    WorkingMemory.OrderList.Remove(k);
                }
            }

            Console.Clear();
            Console.WriteLine("\nALL ORDERS FOR {0}:", date);
            Console.WriteLine();
            Output.DisplayAllOrders();

            var result = Input.QueryForCommit();

            ChangeOrder.CommitChangesToFile(result);
            Output.DisplayCommitResults(result);
            WorkingMemory.OrderList.Clear();

            Screen next = new HomeScreen();

            Screen.JumpScreen(next);
        }
Exemple #3
0
        public override void Display()
        {
            Console.Clear();
            DisplayHeader();
            string date = Input.GetDate("Enter the date of a file to display orders from that date: ");

            WorkingMemory.OrderList.Clear();
            SetTestOrProd.MyOrderObject.LoadOrderFile(date);

            RejectEmptyDate();


            Output.DisplayViewChooser();
            Console.Write("Press enter to return to the main menu.");
            Console.ReadLine();

            Screen next = new HomeScreen();

            Screen.JumpScreen(next);
        }
Exemple #4
0
        public override void Display()
        {
            Console.Clear();
            DisplayHeader();
            WorkingMemory.OrderList.Clear();
            Console.WriteLine();
            SetTestOrProd.MyOrderObject.LoadOrderFile(Input.GetDate("Enter the date of the order: "));
            Console.WriteLine();

            Order newOrder = Input.QueryUserForOrder();

            Console.Clear();
            Output.DisplaySingleOrder(newOrder);

            var doCommit = Input.QueryForCommit();

            ChangeOrder.CommitAdditionsToFile(doCommit, newOrder);
            Output.DisplayCommitResults(doCommit);

            Screen next = new HomeScreen();

            Screen.JumpScreen(next);
        }