public void Execute() { bool isValidDate = false; bool idValid = false; int userId = 0; Console.Clear(); while (isValidDate == false) { dateString = io.PromptUserForDate("What date would you like to look up: "); userDate = DateTime.ParseExact(dateString, "MMddyyyy", CultureInfo.GetCultureInfo("en-us")); displayResponse = manager.DisplayOrders(dateString); if (displayResponse.Success == true) { foreach (Order order in displayResponse.Orders) { io.DisplayOrder(order, userDate); } isValidDate = true; } } userId = io.PromptUserForInt("What order would you like to remove: "); while (idValid == false) { foreach (Order order in displayResponse.Orders) { if (userId == order.OrderNumber) { ConfirmRemoveOrder(order); idValid = true; break; } else { Console.WriteLine("Please enter a vaild order number"); } } } }
private void EditOrderDate() { bool isValidDate = false; while (isValidDate == false) { dateString = io.PromptUserForDate("What date would you like to look up: "); userDate = DateTime.ParseExact(dateString, "MMddyyyy", CultureInfo.GetCultureInfo("en-us")); displayResponse = manager.DisplayOrders(dateString); if (displayResponse.Success == true) { foreach (Order order in displayResponse.Orders) { io.DisplayOrder(order, userDate); } isValidDate = true; } } }
private void CreateOrderDate() { bool isValidDate = false; Console.Clear(); while (isValidDate == false) { dateString = io.PromptUserForDate("Please enter your order date: "); userDate = DateTime.ParseExact(dateString, "MMddyyyy", CultureInfo.GetCultureInfo("en-us")); if (userDate < DateTime.Today) { Console.WriteLine("Invalid date entry, please try again"); } else { isValidDate = true; } } }
public void Execute() { Console.Clear(); string dateString = ""; dateString = io.PromptUserForDate("What date would you like to look up: "); DateTime userDate = DateTime.ParseExact(dateString, "MMddyyyy", CultureInfo.GetCultureInfo("en-us")); response = manager.DisplayOrders(dateString); if (response.Success == true) { foreach (Order order in response.Orders) { io.DisplayOrder(order, userDate); } } Console.WriteLine("Press enter to exit to main menu : "); Console.ReadLine(); }