public void Execute()
        {
            DisplayOrderWorkFlow displayOrder = new DisplayOrderWorkFlow();
            string dateToSearch = displayOrder.GetOrderDate();

            displayOrder.OrderInformationSearch(dateToSearch);
            int deleteThisOrderNumber = GetOrderNumberToDelete();

            OrderOperations pullOrderOperations = new OrderOperations(OrderRepositoryFactory.CreateOrderRepository());
            var             order = pullOrderOperations.PullingOrder(deleteThisOrderNumber);

            OrderOperations remove = new OrderOperations(OrderRepositoryFactory.CreateOrderRepository());

            bool   isValid = false;
            string confirm = "";

            while (!isValid)
            {
                DisplayRemoveOrder(order);

                Console.WriteLine();
                Console.WriteLine("Are you sure?");
                Console.WriteLine("Enter (Y) or (N)");

                confirm = Console.ReadLine().ToUpper();

                if (string.IsNullOrEmpty(confirm))
                {
                    isValid = false;
                    Console.WriteLine("Please enter (Y) or (N)");
                    Console.WriteLine("Press ENTER to continue");
                    Console.ReadLine();
                }
                else if ((confirm != "N") && (confirm != "Y"))
                {
                    isValid = false;
                    Console.WriteLine("{0} is not a \"Y\" or \"N\"", confirm);
                    Console.WriteLine("Press ENTER to continue");
                    Console.ReadLine();
                }
                else
                {
                    isValid = true;
                }


                if (confirm == "Y")
                {
                    var test = remove.RemoveOrder(deleteThisOrderNumber);

                    Console.Clear();
                    Console.WriteLine();
                    Console.WriteLine("The odrer with the number of {0}, has been removed", test);
                    Console.WriteLine("Press ENTER to Continue.");
                    Console.ReadLine();
                }
            }
        }
Example #2
0
        public void Execute()
        {
            DisplayOrderWorkFlow displayOrder = new DisplayOrderWorkFlow();
            string dateToSearch = displayOrder.GetOrderDate();

            displayOrder.OrderInformationSearch(dateToSearch);

            int editThisOrderNumber = GetOrderNumberToEdit();

            OrderOperations pullOrder   = new OrderOperations(OrderRepositoryFactory.CreateOrderRepository());
            var             orderToEdit = pullOrder.PullingOrder(editThisOrderNumber);

            DisplayOrderToEdit(orderToEdit);
        }