Example #1
0
        public void Execute()
        {
            var response = orderOps.GetOrders(editDate);

            do
            {
                editDate = displayWorkflow.GetOrderDateFromUser();
                response = orderOps.GetOrders(editDate);
                if (response.Success == false)
                {
                    Console.WriteLine("That was an invalid entry. Please enter a valid date. Press enter to continue.");
                    Console.ReadLine();
                }
            } while (response.Success == false);

            var orderNumber = UserPrompts.GetOrderNumber();

            //PrintOrderToEdit(editDate, orderNumber);



            var   editingOrder     = orderOps.GetOrderToEdit(editDate, orderNumber);
            Order OrderBeingEdited = CreateEditOrder(editingOrder);

            orderOps.NewOrderCalculations(OrderBeingEdited);
            OrderBeingEdited.OrderNumber = orderNumber;
            orderOps.AddNewOrder(OrderBeingEdited, editDate);
            orderOps.RemovePreEditedOrder(OrderBeingEdited, editDate);

            Console.WriteLine("Here is your updated order information: ");
            Console.WriteLine("========| Updated Order Confirmation | ========");
            Console.WriteLine("Order number: {0}", OrderBeingEdited.OrderNumber);
            Console.WriteLine("Customer Name: {0}", OrderBeingEdited.CustomerName);
            Console.WriteLine("Product Type: {0}", OrderBeingEdited.ProductType);
            Console.WriteLine("Product Cost Per Square Foot: {0:c}", OrderBeingEdited.CostPerSquareFoot);
            Console.WriteLine("Labor Cost Per Square Foot: {0:c}", OrderBeingEdited.LaborCostPerSquareFoot);
            Console.WriteLine("Amount Ordered: {0}sqft", OrderBeingEdited.Area);
            Console.WriteLine("Total Material Cost: {0:c}", OrderBeingEdited.MaterialCost);
            Console.WriteLine("Total Labor Cost: {0:c}", OrderBeingEdited.LaborCost);
            Console.WriteLine("Tax: {0:c}", OrderBeingEdited.Tax);
            Console.WriteLine("Total: {0:c}", OrderBeingEdited.Total);

            Console.ReadLine();
        }
Example #2
0
        public OrdersViewModel GetOrdersViewModel(string orderId, OrderStatuses?orderStatus,
                                                  string userEmail, int page, int pageSize)
        {
            OrdersViewModel model = new OrdersViewModel
            {
                Orders     = orderOperations.GetOrders(page, pageSize, orderStatus, userEmail, orderId),
                PagingInfo = new PagingInfoViewModel
                {
                    CurrentPage  = page,
                    ItemsPerPage = pageSize,
                    TotalItems   = orderRepository.GetAllOrders().Count()
                },
                SelectedStatus = orderStatus
            };

            return(model);
        }
        public void Execute()
        {
            DateTime removeDate  = displayOrdersWorkflow.GetOrderDateFromUser();
            int      orderNumber = editOrderWorkflow.GetOrderNumber();

            orderToRemove.OrderNumber = orderNumber;
            orderOps.GetOrders(removeDate);
            response = orderOps.GetOrderToEdit(removeDate, orderNumber);

            RemoveOrderToConfirm(response.Data, removeDate);


            if (response.Success)
            {
                Console.WriteLine("Order {0} has been deleted.", orderToRemove.OrderNumber);
            }
            else
            {
                Console.WriteLine(response.Message);
            }
        }
        private void DisplayOrderInformation(DateTime orderDate)
        {
            var ops      = new OrderOperations();
            var response = ops.GetOrders(orderDate);

            Console.Clear();

            if (response.Success)
            {
                PrintOrderDetails(response.Data, orderDate);

                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("A problem occurred...");
                Console.WriteLine(response.Message);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }