public bool KassaMenu() { string[] options = new string[] { "Add a new ingredient", "Order an ingredient", "View a list of all ingredient", "Create a new pizza", "View a list of all pizzas", "Make a new order", "Show orders", "Quit" }; int input = UserIO.Menu(options, AppConstands.Title); switch (input) { case 0: Console.Clear(); Ingredient_Manager.CreateNewIngredient(); Console.ReadLine(); return(true); case 1: Console.Clear(); Ingredient_Manager.OrderIngredient(); Console.ReadLine(); return(true); case 2: Console.Clear(); Ingredient_Manager.ShowAllIngredients(); Console.ReadLine(); return(true); case 3: Console.Clear(); Pizza_Manager.CreateNewPizza(); Console.ReadLine(); return(true); case 4: Pizza_Manager.ShowAllPizzas(); return(true); case 5: Console.Clear(); Order_Manager.MakeOrder(); Console.ReadLine(); return(true); case 6: Order_Manager.ShowOrders(); //Order_Manager.DisplayOrderList(); return(true); case 7: //quit return(false); default: Console.WriteLine("Give a vallid input plz!"); Console.ReadLine(); return(true); } }
public KassaSysteem() { IngredientManager ingredientManager = new IngredientManager(); Ingredient_Manager = ingredientManager; PizzaManager pizzaManager = new PizzaManager(); Pizza_Manager = pizzaManager; OrderManager orderManager = new OrderManager(); Order_Manager = orderManager; Ingredient_Manager.SetGlobalIngredients(); }
public void MakeOrder() { PizzaManager pizzamanager = new PizzaManager(); Pizza_Manager = pizzamanager; IngredientManager ingredientManager = new IngredientManager(); Ingredient_Manager = ingredientManager; Order newOrder = new Order(); bool ordering = true; ItemIndex = 0; while (ordering) { Console.Clear(); ShowCart(newOrder); GetUserInput(newOrder); SetOrder(newOrder); Console.Clear(); ShowCart(newOrder); ItemIndex++; Console.WriteLine("Want some more? y/n"); ordering = UserIO.AskYesNoQ(); } //check if order can be made bool succes = CheckItemsAvailable(newOrder); if (!succes) { UserIO.PrintRed("---The order could not be made!---"); Ingredient_Manager.SetGlobalIngredients(); return; } Ingredient_Manager.UpdateIngredients(); UserIO.PrintGreen("Order was made"); //print factuur Console.ReadLine(); ShowInvoice(newOrder); //store order StoreOrder(newOrder); }
private void ShowBalanceForDay(int day) { //Loop true all orders and add the prices. fill 2 lists: one with all used ingredients (id), //the other with times they where used (quantity * size) 1=small 2=med 3=large double earningsDay = 0; int itemsDay = 0; List <int> ingredientId = new List <int>(); List <int> ingredientCount = new List <int>(); foreach (var order in SortedByDay[day]) { earningsDay += order.TotalPrice; itemsDay += order.ItemCount; for (int i = 0; i < order.ItemsArray.Length; i++) { int pizzaId = order.ItemsArray[i][0]; int pizzaSize = order.ItemsArray[i][1]; int pizzaQuantity = order.ItemsArray[i][3]; //Console.WriteLine(pizzaId); int[] pizzaIngr = Pizza_Manager.GlobalPizzas[pizzaId].Ingredients; //loop over pizza ingredients for (int j = 0; j < pizzaIngr.Length; j++) { //if id is not in list, ad to list, else add count to existing if (!ingredientId.Contains(pizzaIngr[j])) { ingredientId.Add(pizzaIngr[j]); ingredientCount.Add(pizzaSize * pizzaQuantity); } else { int index = ingredientId.IndexOf(pizzaIngr[j]); ingredientCount[index] += pizzaSize * pizzaQuantity; } } } } IngredientManager ingredientManager = new IngredientManager(); Ingredient_Manager = ingredientManager; //Display obtained info Console.Clear(); UserIO.PrintRed($"Balance for Day {SortedByDay[day][0].Date.ToString("d")}"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; UserIO.PrintPretty("Ingredient used", 20, "Times used"); Console.WriteLine(); Console.ResetColor(); for (int i = 0; i < ingredientId.Count; i++) { UserIO.PrintPretty($"{ Ingredient_Manager.GetOneIngredient(ingredientId[i]) }", 20, $"{ ingredientCount[i] }"); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"Total Items sold: {itemsDay}"); UserIO.PrintGreen($"Total income: {earningsDay} EUR"); Console.WriteLine(); UserIO.PrintDarkRed("Press enter to go back"); Console.ReadLine(); }