public void OrderToConfirm(Order orderToAdd) { var orderOps = new OrderOperations(); DateTime orderDateToday = DateTime.Today; var confirmOrder = ""; bool validEntry = true; do { Console.WriteLine("Would you like to place this order? Please enter Yes or No."); confirmOrder = Console.ReadLine(); confirmOrder = confirmOrder.Substring(0, 1).ToUpper(); if (confirmOrder != "Y" && confirmOrder != "N") { Console.WriteLine("That is an invalid entry. Please input yes or no."); validEntry = false; } if (string.IsNullOrEmpty(confirmOrder)) { Console.WriteLine("You must make a selection. Please input Yes or No."); validEntry = false; } else { validEntry = true; } } while (!validEntry); if (confirmOrder == "Y") { orderOps.NewOrderNumber(orderToAdd, orderDateToday); var response = orderOps.AddNewOrder(orderToAdd, orderDateToday); if (response.Success) { Console.WriteLine("========| Order Confirmation | ========"); Console.WriteLine("Order number: {0}", response.Data.OrderNumber); Console.WriteLine("Product Type: {0}", response.Data.ProductType); Console.WriteLine("Amount Ordered: {0}sqft", response.Data.Area); Console.WriteLine("Material Cost: {0:c}", response.Data.MaterialCost); Console.WriteLine("Labor Cost: {0:c}", response.Data.LaborCost); Console.WriteLine("Tax: {0:c}", response.Data.Tax); Console.WriteLine("Total: {0:c}", response.Data.Total); } } else { var response = orderOps.AddNewOrder(orderToAdd, orderDateToday); Console.WriteLine(response.Message); } }
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(); }