//Add new Set Meal public static void ManagerAddSetMeal() { Console.WriteLine("\nFill in new Set Meal details"); Console.Write("Name: "); string addSetName = Console.ReadLine(); List <FoodItem> newFooditemlist = new List <FoodItem>(); Console.WriteLine("\nItems Available to add"); while (true) { foreach (Menu m in Globals.MenuList) { if (m is FoodItem) { Console.WriteLine("Item Name: " + m.name); } } Console.Write("What item do you want to add:"); string item = Console.ReadLine(); foreach (Menu m in Globals.MenuList) { if (m is FoodItem) { if (m.name.ToUpper() == item.ToUpper()) { FoodItem newitem = m as FoodItem; newFooditemlist.Add(newitem); Console.WriteLine("Item added successfully"); break; } } } Console.Write("Do you want to add another item? (YES/NO): "); string choice = Console.ReadLine(); if (choice.ToUpper() == "NO") { break; } } Console.Write("Description: "); string addSetDesc = Console.ReadLine(); Console.Write("Price: "); string addSetPrice = Console.ReadLine(); Console.Write("Quantity: "); string addSetQty = Console.ReadLine(); Console.Write("Size: "); string addSetSize = Console.ReadLine(); Console.Write("Preparation Time: "); string addSetTime = Console.ReadLine(); int id = Globals.MenuList.Count + 1; SetMeal newSet = new SetMeal(id, addSetName, newFooditemlist, addSetDesc, float.Parse(addSetPrice), int.Parse(addSetQty), int.Parse(addSetSize), int.Parse(addSetTime)); Globals.MenuList.Add(newSet); Console.WriteLine("\nSet meal added successfully!"); foreach (Menu m in Globals.MenuList) { if (m is SetMeal) { Console.WriteLine("Meal Name: " + m.name); } } Console.ReadLine(); }
//Update Set Meal public static void ManagerUpdateSetMeal() { SetMeal updateMeal = new SetMeal(); Console.WriteLine("Which meal do you want to update?"); foreach (Menu m in Globals.MenuList) { if (m is SetMeal) { updateMeal = m as SetMeal; Console.WriteLine("Name: " + m.name); } } Console.Write("\nSelect Item name: "); String name = Console.ReadLine(); Console.WriteLine("How would you like to update the Items in the Set Meal?"); Console.WriteLine("[1]Add Item to list"); Console.WriteLine("[2]Remove Item from list"); Console.WriteLine("[3]Keep the List the same"); string updatingOptions = Console.ReadLine(); //Add item to list and update the other details if (updatingOptions == "1") { //Console.WriteLine("Add food item details"); //Console.WriteLine("\nItems Available to add"); //string addSetName = Console.ReadLine(); List <FoodItem> newItemList = new List <FoodItem>(); while (true) { foreach (Menu m in Globals.MenuList) { if (m is FoodItem) { Console.WriteLine("Item Name: " + m.name); } } Console.Write("What item do you want to add:"); string item = Console.ReadLine(); foreach (Menu m in Globals.MenuList) { if (m is FoodItem) { if (m.name.ToUpper() == item.ToUpper()) { FoodItem newitem = m as FoodItem; newItemList.Add(newitem); Console.WriteLine("Item added successfully"); Console.WriteLine(newitem); break; } } } Console.Write("Do you want to add another item? (YES/NO): "); string choice = Console.ReadLine(); if (choice.ToUpper() == "NO") { break; } } foreach (SetMeal m in Globals.MenuList) { Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); Console.WriteLine("\nUpdate item Info:"); Console.WriteLine("Input 'Same' if you want to keep the old information"); Console.Write("New Name: "); string newSetname = Console.ReadLine(); Console.Write("New Description: "); string newSetdesc = Console.ReadLine(); Console.Write("New Price: "); string newSetprice = Console.ReadLine(); Console.Write("New Quantity: "); string newSetQty = Console.ReadLine(); Console.Write("New Size: "); string newSetSize = Console.ReadLine(); Console.Write("New Prep Time: "); string newTime = Console.ReadLine(); if (newSetname.ToUpper() != "SAME") { m.name = newSetname; } if (newSetdesc.ToUpper() != "SAME") { m.description = newSetdesc; } if (newSetprice.ToUpper() != "SAME") { m.price = float.Parse(newSetprice); } if (newSetQty.ToUpper() != "SAME") { m.unit = int.Parse(newSetQty); } if (newSetSize.ToUpper() != "SAME") { m.size = int.Parse(newSetSize); } if (newTime.ToUpper() != "SAME") { m.prepTime = int.Parse(newTime); } Console.WriteLine("Update Successful!"); Console.WriteLine("\nUpdated Information"); Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); break; } } //Remove item from list and update other details if (updatingOptions == "2") { foreach (Menu m in Globals.MenuList) { if (m is SetMeal) { Console.WriteLine("Current List items: " + m.foodItemList); } } Console.WriteLine("Please input item to remove: "); // Suppose to display list of current items string item = Console.ReadLine(); foreach (SetMeal m in Globals.MenuList) { Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); Console.WriteLine("\nUpdate item Info:"); Console.WriteLine("Input 'Same' if you want to keep the old information"); Console.Write("New Name: "); string newSetname = Console.ReadLine(); Console.Write("New Description: "); string newSetdesc = Console.ReadLine(); Console.Write("New Price: "); string newSetprice = Console.ReadLine(); Console.Write("New Quantity: "); string newSetQty = Console.ReadLine(); Console.Write("New Size: "); string newSetSize = Console.ReadLine(); Console.Write("New Prep Time: "); string newTime = Console.ReadLine(); if (newSetname.ToUpper() != "SAME") { m.name = newSetname; } if (newSetdesc.ToUpper() != "SAME") { m.description = newSetdesc; } if (newSetprice.ToUpper() != "SAME") { m.price = float.Parse(newSetprice); } if (newSetQty.ToUpper() != "SAME") { m.unit = int.Parse(newSetQty); } if (newSetSize.ToUpper() != "SAME") { m.size = int.Parse(newSetSize); } if (newTime.ToUpper() != "SAME") { m.prepTime = int.Parse(newTime); } Console.WriteLine("Update Successful!"); Console.WriteLine("\nUpdated Information"); Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); break; } } //Keep the list same and only change other details if (updatingOptions == "3") { foreach (SetMeal m in Globals.MenuList) { Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); Console.WriteLine("\nUpdate item Info:"); Console.WriteLine("Input 'Same' if you want to keep the old information"); Console.Write("New Name: "); string newSetname = Console.ReadLine(); Console.Write("New Description: "); string newSetdesc = Console.ReadLine(); Console.Write("New Price: "); string newSetprice = Console.ReadLine(); Console.Write("New Quantity: "); string newSetQty = Console.ReadLine(); Console.Write("New Size: "); string newSetSize = Console.ReadLine(); Console.Write("New Prep Time: "); string newTime = Console.ReadLine(); if (newSetname.ToUpper() != "SAME") { m.name = newSetname; } if (newSetdesc.ToUpper() != "SAME") { m.description = newSetdesc; } if (newSetprice.ToUpper() != "SAME") { m.price = float.Parse(newSetprice); } if (newSetQty.ToUpper() != "SAME") { m.unit = int.Parse(newSetQty); } if (newSetSize.ToUpper() != "SAME") { m.size = int.Parse(newSetSize); } if (newTime.ToUpper() != "SAME") { m.prepTime = int.Parse(newTime); } Console.WriteLine("Update Successful!"); Console.WriteLine("\nUpdated Information"); Console.WriteLine("Name: " + m.name); Console.WriteLine("Description: " + m.description); Console.WriteLine("Price: " + m.price); Console.WriteLine("Quantity: " + m.unit); Console.WriteLine("Size: " + m.size); Console.WriteLine("Preparation Time: " + m.prepTime); break; } } }
static void Main(string[] args) { Console.Title = "FHungryEatNow Food Ordering System"; //Test Data for Order //Test Data 1 Customer cust1 = new Customer(1, "Avin", "Ngee Ann Poly", "*****@*****.**", 91234567); Dispatcher disp1 = new Dispatcher("mohd", 1, "S9912313C", "Male", 97654321, DateTime.Now, "new"); List <OrderLine> orderLineList1 = new List <OrderLine>(); List <SetMeal> setMealList1 = new List <SetMeal>(); List <FoodItem> foodItemList1 = new List <FoodItem>(); FoodItem m1 = new FoodItem(1, "Chicken Nugget", "Tasty Chicken Nugget", 12, 1, 10); OrderLine ol1 = new OrderLine(1, m1); FoodItem m2 = new FoodItem(1, "Whole Chicken", "Tasty Chicken ", 12, 1, 15); OrderLine ol2 = new OrderLine(2, m2); orderLineList1.Add(ol1); orderLineList1.Add(ol2); Order a = new Order(1, "New", new DateTime(2020, 2, 14, 12, 45, 3), "Cash", cust1, orderLineList1); //Test Data 2 Customer cust2 = new Customer(2, "Diego", "Ngee Ann Poly", "*****@*****.**", 91234567); Dispatcher disp2 = new Dispatcher("Ali", 1, "S9912313C", "Male", 97654321, DateTime.Now, "new"); List <OrderLine> orderLineList2 = new List <OrderLine>(); FoodItem m3 = new FoodItem(1, "Chicken Burger", "Tasty Chicken Patty", 12, 1, 10); OrderLine ol3 = new OrderLine(1, m1); FoodItem m4 = new FoodItem(1, "Pasta", "Tasty Chicken ", 12, 1, 8); OrderLine ol4 = new OrderLine(2, m2); List <FoodItem> s1list = new List <FoodItem>(); s1list.Add(m3); s1list.Add(m4); SetMeal s1 = new SetMeal(10, "Pasta and Burger Meal", s1list, "Great meal with both a chicken burger and pasta", 20, 300, 2, 15); List <FoodItem> s2list = new List <FoodItem>(); s2list.Add(m1); s2list.Add(m2); SetMeal s2 = new SetMeal(20, "Nugget and Whole Chicken Meal", s2list, "Get best of both chickens", 30, 200, 4, 20); Globals.MenuList.Add(s1); Globals.MenuList.Add(s2); //new, preparing, ready, dispatched, delivered, cancelled orderLineList2.Add(ol1); orderLineList2.Add(ol2); Order b = new Order(2, "Preparing", new DateTime(2017, 1, 18, 12, 20, 3), "Cash", cust2, orderLineList2); Order c = new Order(3, "Ready", new DateTime(2018, 1, 20, 10, 27, 3), "Cash", cust1, orderLineList2); Order d = new Order(4, "Dispatched", new DateTime(2019, 6, 23, 2, 32, 3), "Cash", cust1, orderLineList2); Order e = new Order(5, "Delivered", new DateTime(2019, 6, 16, 12, 54, 3), "Cash", cust2, orderLineList2); Order f = new Order(6, "Cancelled", new DateTime(2019, 5, 24, 12, 12, 3), "Cash", cust2, orderLineList2); Globals.MenuList.Add(m1); Globals.MenuList.Add(m2); Globals.MenuList.Add(m3); Globals.MenuList.Add(m4); Globals.CustomerList.Add(cust1); Globals.OrderList.Add(a); Globals.OrderList.Add(b); Globals.OrderList.Add(c); Globals.OrderList.Add(d); Globals.OrderList.Add(e); Globals.OrderList.Add(f); //Message while (true) { Console.Write("\nWhat is your role? \n[1]Customer\n[2]Manager\n[3]Chef\nInput Option:"); string role = Console.ReadLine(); if (role == "1") { customerProcess(cust1); } else if (role == "2") { managerProcess(); } else if (role == "3") { Chef chef = new Chef("Darren", 1, "S101010G", "MTF", 12345678, DateTime.Now, "Gay"); chefProcess(chef); } else { Console.WriteLine("Option does not exist! Try again!"); } } }