static void AddPizzaConfirmMenu() { var customersRepo = Dependencies.CreateCustomerRepository(); Customers currCustomer = customersRepo.GetCurrentCustomer(); var restaurantsRepo = Dependencies.CreateRestaurantRepository(); Restaurants currRestaurant = restaurantsRepo.GetCurrentRestaurant(); var pizzasRepo = Dependencies.CreatePizzaRepository(); Pizza currPizza = pizzasRepo.GetCurrentPizza(); var ordersRepo = Dependencies.CreateOrderRepository(); OptionsGenerator pizzaConfirmMenu = new OptionsGenerator(); pizzaConfirmMenu.Add("y", "yes"); pizzaConfirmMenu.Add("n", "no"); var userInput = ""; do { Console.Clear(); Console.WriteLine("\n" + PadMiddle($"Confirm Add Pizza ({currRestaurant.RestaurantName}) ({currCustomer.Username}) ")); pizzasRepo.DisplayCurrPizzaInfo(); DashPaddings(); pizzaConfirmMenu.DisplayOptions(); DashPaddings(); Console.Write("Input: "); userInput = Console.ReadLine(); switch (userInput) { case "y": Console.WriteLine("ADDED TO ORDER"); // add currpizza to order currPizza.PriceTotal = pizzasRepo.GetTotalPrice(currPizza, currRestaurant.RestaurantMarkup.Value); ordersRepo.AddPizzaToOrder(currPizza, currCustomer.CustomerId, currRestaurant.RestaurantId); // OrderConfirmMenu(); break; case "n": Console.WriteLine("NOT ADDED TO ORDER"); RestaurantMenu(); break; } } while (true); }
static void CustomPizzaMenu() { var customersRepo = Dependencies.CreateCustomerRepository(); Customers currCustomer = customersRepo.GetCurrentCustomer(); var restaurantsRepo = Dependencies.CreateRestaurantRepository(); Restaurants currRestaurant = restaurantsRepo.GetCurrentRestaurant(); var pizzasRepo = Dependencies.CreatePizzaRepository(); OptionsGenerator extraMenu = new OptionsGenerator(); extraMenu.Add("b", "Back to RestaurantMenu"); extraMenu.Add("q", "Quit"); var userInput = ""; do { Console.Clear(); Console.WriteLine("\n" + PadMiddle($"Custom Pizza ({currRestaurant.RestaurantName}) ({currCustomer.Username}) ")); DashPaddings(); extraMenu.DisplayOptions(); DashPaddings(); Console.Write("Input: "); userInput = Console.ReadLine(); if (userInput == "b") { RestaurantMenu(); break; } else if (userInput == "q") { Quit(); break; } } while (userInput != "q"); }
static void OrderConfirmMenu() { var pizzasRepo = Dependencies.CreatePizzaRepository(); var ordersRepo = Dependencies.CreateOrderRepository(); Orders currOrder = ordersRepo.GetCurrentOrder(); OptionsGenerator extraOptions = new OptionsGenerator(); extraOptions.Add("c", "Confirm Order"); extraOptions.Add("x", "Cancel Order"); extraOptions.Add("e", "Edit Order(TODO)"); extraOptions.Add("b", "Back to Store Menu"); extraOptions.Add("q", "Quit"); List <Pizza> pizzas = ordersRepo.GetCurrOrderPizzas(); if (pizzas.Count <= 0) { Console.WriteLine("NO CURRENT ORDER"); PressAnyToContinue(); RestaurantMenu(); } string userInput; do { var customersRepo = Dependencies.CreateCustomerRepository(); Customers currCustomer = customersRepo.GetCurrentCustomer(); var restaurantsRepo = Dependencies.CreateRestaurantRepository(); Restaurants currRestaurant = restaurantsRepo.GetCurrentRestaurant(); Console.Clear(); Console.WriteLine("\n" + PadMiddle($"View Order ({currCustomer.Username}) ({currRestaurant.RestaurantName}) (Total = $)")); int i = 1; foreach (Pizza p in pizzas) { DashPaddings(); Console.WriteLine("Pizza #".PadRight(10) + i); pizzasRepo.DisplayFullPizzaInfo(p, currRestaurant.RestaurantMarkup.Value); Console.WriteLine("\n" + $"Total# {i}:".PadRight(70) + $"$ {pizzasRepo.GetTotalPrice(p).ToString("0.00")}"); i++; } DashPaddings(); Console.WriteLine("Subtotal:".PadRight(70) + $"$ {ordersRepo.GetSubtotal().ToString(("0.00"))}"); DashPaddings(); extraOptions.DisplayOptions(); DashPaddings(); Console.Write("Input: "); userInput = Console.ReadLine(); switch (userInput) { case "c": ordersRepo.SubmitOrder(currCustomer.CustomerId, currRestaurant.RestaurantId); RestaurantSelectMenu(); break; case "x": // cancel order ordersRepo.RemoveCurrOrder(); RestaurantMenu(); break; case "e": //TODO edit order //PizzaSelectMenu(); break; case "b": RestaurantMenu(); break; case "q": Quit(); break; } } while (userInput != "q"); }
static void PresetPizzaMenu() { var customersRepo = Dependencies.CreateCustomerRepository(); Customers currCustomer = customersRepo.GetCurrentCustomer(); var restaurantsRepo = Dependencies.CreateRestaurantRepository(); Restaurants currRestaurant = restaurantsRepo.GetCurrentRestaurant(); var pizzasRepo = Dependencies.CreatePizzaRepository(); List <int> pizzaIDList = restaurantsRepo.GetCurrRestaurantPizzaIDList(); OptionsGenerator extraMenu = new OptionsGenerator(); extraMenu.Add("b", "Back to RestaurantMenu"); extraMenu.Add("q", "Quit"); //OptionsGenerator pizzasMenu = new OptionsGenerator(); //foreach (Pizza p in restaurantsRepo.GetCurrRestaurantPizzas()) //{ // pizzasMenu.Add(p.PizzaId.ToString(), p.PizzaName, pizzasRepo.GetTotalPrice(p.PizzaId) + currRestaurant.RestaurantMarkup.Value); //} string userInput; do { Console.Clear(); Console.WriteLine("\n" + PadMiddle($"Pizza Selection ({currRestaurant.RestaurantName}) ({currCustomer.Username}) ")); Console.WriteLine("Code".PadRight(10) + "Pizza".PadRight(30) + "Personal".PadRight(10) + "Medium".PadRight(10) + "Large".PadRight(10) + "XLarge"); DashPaddings(); foreach (Pizza p in restaurantsRepo.GetCurrRestaurantPizzas()) { string pricePersonal = (pizzasRepo.GetTotalPrice(p.PizzaId, new Size { PriceMultiplier = 0.8 }) + currRestaurant.RestaurantMarkup.Value).ToString("0.00"); string priceMedium = (pizzasRepo.GetTotalPrice(p.PizzaId, new Size { PriceMultiplier = 1 }) + currRestaurant.RestaurantMarkup.Value).ToString("0.00"); string priceLarge = (pizzasRepo.GetTotalPrice(p.PizzaId, new Size { PriceMultiplier = 1.5 }) + currRestaurant.RestaurantMarkup.Value).ToString("0.00"); string priceXtraLarge = (pizzasRepo.GetTotalPrice(p.PizzaId, new Size { PriceMultiplier = 2.1 }) + currRestaurant.RestaurantMarkup.Value).ToString("0.00"); Console.WriteLine(p.PizzaId.ToString().PadRight(10) + p.PizzaName.PadRight(30) + pricePersonal.PadRight(10) + priceMedium.PadRight(10) + priceLarge.PadRight(10) + priceXtraLarge); } //pizzasMenu.DisplayOptions(1); DashPaddings(); extraMenu.DisplayOptions(); DashPaddings(); Console.Write("Input: "); userInput = Console.ReadLine(); if (int.TryParse(userInput, out int pizzaID)) { // numeric input if (pizzaIDList.Contains(pizzaID)) { pizzasRepo.SetCurrentPizza(pizzaID, currRestaurant); Pizza currPizza = pizzasRepo.GetCurrentPizza(); // select pizza Console.Write("\nSize? (p) (m) (l) (x): "); userInput = Console.ReadLine(); if (userInput == "p") { pizzasRepo.SetCurrentPizzaSize(1); } else if (userInput == "m") { pizzasRepo.SetCurrentPizzaSize(2); } else if (userInput == "l") { pizzasRepo.SetCurrentPizzaSize(3); } else if (userInput == "x") { pizzasRepo.SetCurrentPizzaSize(4); } AddPizzaConfirmMenu(); break; } } else if (userInput == "b") { RestaurantMenu(); break; } else if (userInput == "q") { Environment.Exit(-1); break; } } while (userInput != "q"); }
static void RestaurantMenu() { var customersRepo = Dependencies.CreateCustomerRepository(); Customers currCustomer = customersRepo.GetCurrentCustomer(); var restaurantsRepo = Dependencies.CreateRestaurantRepository(); Restaurants currRestaurant = restaurantsRepo.GetCurrentRestaurant(); var ordersRepo = Dependencies.CreateOrderRepository(); OptionsGenerator storeMenu = new OptionsGenerator(); storeMenu.Add("p", "PresetPizzas"); storeMenu.Add("c", "CustomPizza(TODO)"); storeMenu.Add("v", "ViewCurrentOrder"); storeMenu.Add("h", "UserStoreOrderHistory"); storeMenu.Add("r", "StoreOrderHistory"); storeMenu.Add("b", "Back to Store Selection"); storeMenu.Add("s", "SignOut"); storeMenu.Add("q", "Quit"); string userInput; do { Console.Clear(); Console.WriteLine("\n" + PadMiddle($"Store Menu ({currRestaurant.RestaurantName}) ({currCustomer.Username}) ")); storeMenu.DisplayOptions(); DashPaddings(); Console.Write("Input: "); userInput = Console.ReadLine(); switch (userInput) { case "p": PresetPizzaMenu(); break; case "c": CustomPizzaMenu(); break; case "v": OrderConfirmMenu(); break; case "h": ordersRepo.ViewOrderHistory(currCustomer.CustomerId, currRestaurant.RestaurantId); PressAnyToContinue(); break; case "r": ordersRepo.ViewStoreOrderHistory(currRestaurant.RestaurantId); PressAnyToContinue(); break; case "b": RestaurantSelectMenu(); break; case "s": SignOut(); break; case "q": Environment.Exit(-1); break; } }while (userInput != "q"); }