public void Execute() { OrderManager manager = new OrderManager(); string date; Order selectedOrder; do { date = GetDate(); var orderNumber = GetOrderNumber(); selectedOrder = manager.GetOrder(date, orderNumber); if (selectedOrder == null) { Console.Clear(); Console.WriteLine("Order does not exist."); Console.Write("\nPress any key to continue, or (Q) to return to main menu..."); string input = Console.ReadLine(); if (input != null && input.ToUpper() == "Q") return; } } while (selectedOrder == null); PrintOrder(selectedOrder); Console.Write("\nPress enter to begin editing..."); Console.ReadLine(); selectedOrder = GetCustomerName(selectedOrder); selectedOrder = GetState(selectedOrder); selectedOrder = GetProductType(selectedOrder); selectedOrder = GetArea(selectedOrder); var response = manager.EditOrder(selectedOrder, date); if (response.Success) { Console.Clear(); Console.WriteLine(response.Message); Console.WriteLine(); PrintEditedOrder(response.Data); } else { Console.Clear(); Console.WriteLine("Something happened."); Console.WriteLine(response.Message); } Console.Write("\nPress any key to continue..."); Console.ReadKey(); }
public void Execute() { OrderManager manager = new OrderManager(); Order orderToRemove; string date; do { date = GetDate(); var orderNumber = GetOrderNumber(); orderToRemove = manager.GetOrder(date, orderNumber); if (orderToRemove == null) { Console.Clear(); Console.WriteLine("Order does not exist."); Console.Write("\nPress any key to continue, or (Q) to return to main menu..."); string input = Console.ReadLine(); if (input != null && input.ToUpper() == "Q") return; } } while (orderToRemove == null); PrintOrderToRemove(orderToRemove); if (!GetConfirmation()) return; var response = manager.RemoveOrder(date, orderToRemove); if (response.Success) { Console.Clear(); Console.WriteLine(response.Message); } else { Console.Clear(); Console.WriteLine("A problem occurred..."); Console.WriteLine(response.Message); } Console.Write("Press any key to continue..."); Console.ReadKey(); }
public void GetOrderTest() { var manager = new OrderManager(); var order = manager.GetOrder("06012013", 1); Assert.AreEqual("Wise", order.Name); }