Ejemplo n.º 1
0
        public void Execute()
        {
            if (userQuestions.Confirmation("Would you like to use today's date?"))
            {
                date = DateTime.Today;
            }
            else
            {
                date = userQuestions.AskDate();
            }

            Order order = QueryTheCustomer();

            DisplayOrdersWF displayOrder = new DisplayOrdersWF();

            var response = orderManager.AddOrder(order, date);

            if (response.Success)
            {
                displayOrder.PrintSingleOrder(order);
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
            }

            else
            {
                Console.WriteLine("An error occurred.");
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
            }
        }
Ejemplo n.º 2
0
        public void Execute()
        {
            var userQuestions = new UserQuestions();
            var orderManager = new OrderManager();
            var displayWF = new DisplayOrdersWF();

            var date = userQuestions.GetDateIfValidFile();

            var orderNumber = userQuestions.GetOrderNumberIfExists(date);

            var order = orderManager.LoadOrder(orderNumber, date);

            Console.WriteLine("This is the order you wish to remove:");
            Console.WriteLine("-----------------------------------");
            displayWF.PrintSingleOrder(order);

            bool wishToRemove = userQuestions.Confirmation("\nAre you sure you wish to delete this order?");

            if (wishToRemove)
            {
                orderManager.RemoveOrder(orderNumber, date);
                Console.WriteLine("You successfully removed the order.");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("The order was not removed.");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }