static void Main() { List <Manager> mList = new List <Manager>(); Manager m = new Manager(); List <Dispatcher> dList = new List <Dispatcher>(); Dispatcher d = new Dispatcher(); List <Chef> cList = new List <Chef>(); Chef c = new Chef(); List <Customer> customerList = new List <Customer>(); Customer customer = new Customer("Victor", 100, 94204209, "*****@*****.**", "535 Clementi Rd, Singapore 599489", oc); List <Receipt> rList = new List <Receipt>(); Receipt r = new Receipt(); string accountType; Console.WriteLine("======= SELECT AN ACCOUNT ======="); Console.WriteLine("[1] Employee"); Console.WriteLine("[2] Customer"); Console.WriteLine("\n ======= EXIT? ======="); Console.WriteLine("[0] Exit Application"); Console.Write("\n Select an Account type: "); accountType = Console.ReadLine(); // EXIT APPLICATION if (accountType == "0") { Environment.Exit(0); } // GOTO EMPLOYEE SCREEN if (accountType == "1") { employeeScreen(m, mList, c, cList, d, dList); } // GOTO CUSTOMER SCREEN else if (accountType == "2") { customerScreen(customer, customerList, r, rList); } Console.ReadKey(); }
// EMPLOYEE SCREEN static void employeeScreen(Manager m, List <Manager> mList, Chef c, List <Chef> cList, Dispatcher d, List <Dispatcher> dList) { List <Customer> customerList = new List <Customer>(); List <Receipt> rList = new List <Receipt>(); initalizer(mList, dList, cList, customerList, rList); while (true) { Console.WriteLine("\n ======= EMPLOYEE SCREEN ======="); Console.WriteLine("[1] Manager"); Console.WriteLine("[2] Chef"); Console.WriteLine("[3] Dispatcher"); Console.WriteLine("\n ======= RETURN ======="); Console.WriteLine("[0] Go to home screen \n"); Console.Write("Select an option: "); string option = Console.ReadLine(); // TO MANAGER SCREEN if (option == "1") { managerScreen(m, mList); } // TO CHEF SCREEN else if (option == "2") { chefScreen(c, cList); } // TO DISPATCHERS SCREEN else if (option == "3") { dispatcherScreen(d, dList); } // HOMESCREEN else if (option == "0") { Main(); } } }
static void Main(string[] args) { InitData(); Object user = null; while (true) { Console.WriteLine("Login"); Console.WriteLine("====="); Console.WriteLine("1 Customer"); Console.WriteLine("2 Employee"); Console.WriteLine("0 Exit"); Console.Write("Please select an option: "); int loginOption = -1; try { loginOption = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); string email = ""; string password = ""; if (loginOption == 1 || loginOption == 2) { user = HandleLogin(loginOption, email, password); if (user is Chef) { DisplayChefMenu((Chef)user); } else if (user is Manager) { DisplayManagerMainMenu((Manager)user); } else if (user is Customer) { DisplayCustomerMenu((Customer)user); } } else if (loginOption == 0) { break; } else { Console.WriteLine("Please enter a valid option!\n"); } } catch { Console.WriteLine("Please enter a valid option!\n"); } } Console.ReadKey(); // Initialize all data here void InitData() { string password = "******"; // Customer Account customerAccount1 = new Account(1, "customer", password); allAccounts.Add(customerAccount1); Customer customer1 = new Customer(1, "customer1", "Yew Tee", "87654321", customerAccount1); allCustomers.Add(customer1); Account customerAccount2 = new Account(2, "*****@*****.**", password); allAccounts.Add(customerAccount2); Customer customer2 = new Customer(2, "customer2", "Yew Tee", "87654321", customerAccount2); allCustomers.Add(customer2); // Manager Account managerAccount1 = new Account(3, "manager", password); allAccounts.Add(managerAccount1); Manager manager1 = new Manager(1, "manager1", "T1234567A", "Male", "87654321", DateTime.Now, "Status", managerAccount1, DateTime.Now); allEmployees.Add(manager1); // Store Assistant Account storeAssistantAccount1 = new Account(4, "*****@*****.**", password); allAccounts.Add(storeAssistantAccount1); StoreAssistant storeAssistant1 = new StoreAssistant(1, "storeAssistant1", "T1234567A", "Male", "87654321", DateTime.Now, "Status", storeAssistantAccount1); allStoreAssistants.Add(storeAssistant1); // Chef Account chefAccount1 = new Account(5, "chef", password); allAccounts.Add(chefAccount1); Chef chef1 = new Chef(1, "chef1", "T1234567A", "Male", "87654321", DateTime.Now, "Status", chefAccount1); allEmployees.Add(chef1); // Dispatcher Account dispatcherAccount1 = new Account(6, "*****@*****.**", password); allAccounts.Add(dispatcherAccount1); Dispatcher dispatcher1 = new Dispatcher(1, "dispatcher1", "T1234567A", "Male", "87654321", DateTime.Now, "Status", dispatcherAccount1); allDispatchers.Add(dispatcher1); Account dispatcherAccount2 = new Account(7, "*****@*****.**", password); allAccounts.Add(dispatcherAccount2); Dispatcher dispatcher2 = new Dispatcher(2, "dispatcher2", "T1234567A", "Male", "87654321", DateTime.Now, "Status", dispatcherAccount2); allDispatchers.Add(dispatcher2); Account dispatcherAccount3 = new Account(8, "*****@*****.**", password); allAccounts.Add(dispatcherAccount3); Dispatcher dispatcher3 = new Dispatcher(3, "dispatcher2", "T1234567A", "Male", "87654321", DateTime.Now, "Status", dispatcherAccount3); allDispatchers.Add(dispatcher3); // FoodItem Item foodItem1 = new Item(1, "Buttermilk Crispy Chicken", "Crispy whole-muscle chicken thigh flavoured with buttermilk packed in a glazed burger bun.", 9.90, 1, "available"); Item foodItem2 = new Item(2, "Original Angus Cheeseburger", "Made from all the things you love – two slices of melty cheese, slivered onions and 100% Angus beef.", 11.90, 1, "available"); Item foodItem3 = new Item(3, "Classic Angus Cheese", "Our delicious classic begins with a juicy 100% Angus beef patty between creamy Colby cheese slices.", 10.90, 1, "available"); Item foodItem4 = new Item(4, "French Fries", "For winning flavour and texture, we only use premium Russet Burbank variety potatoes for that fluffy inside, crispy outside taste of our world-famous fries.", 5.90, 1, "available"); Item foodItem5 = new Item(5, "Apple Slices", "Go fruity with fresh, ready-to-eat apple slices!", 3.20, 1, "available"); Item foodItem6 = new Item(6, "Coca-Cola", "Icy cold cola.", 3.5, 1, "available"); Item foodItem7 = new Item(7, "100% Pure Orange Juice", "Pure orange juice, with Vitamin C.", 3.0, 1, "available"); Item foodItem8 = new Item(8, "Test food", "Food Description", 10.0, 10, "available"); Item[] alacarte = { foodItem1, foodItem2, foodItem3, foodItem4, foodItem5, foodItem6, foodItem7, foodItem8 }; int FICount = 0; //keep id in ascending order foreach (Item a in alacarte) { a.itemId = FICount + 1; allFoodItems.Add(a); FICount++; } // SetMenu SetMenu setMenu1 = new SetMenu(1, "Buttermilk Crispy Chicken Set", "Buttermilk Crispy Chicken with French Fries and Coca-Cola", 12.80, 1, "available"); Item[] setItem1 = { foodItem1, foodItem4, foodItem6 }; int SMIcount = 0; foreach (Item i in setItem1) { SetMenuItem smi = new SetMenuItem(SMIcount + 1, i.name, setMenu1, i); setMenu1.setMenuItemList.Add(smi); SMIcount++; } SetMenu setMenu2 = new SetMenu(2, "Original Angus Cheeseburger Set", "Original Angus Cheeseburger with Apple Slices and 100% Pure Orange Juice", 13.90, 1, "available"); Item[] setItem2 = { foodItem2, foodItem5, foodItem7 }; SMIcount = 0; foreach (Item i in setItem2) { SetMenuItem smi = new SetMenuItem(SMIcount + 1, i.name, setMenu2, i); setMenu2.setMenuItemList.Add(smi); SMIcount++; } SetMenu[] menuList = { setMenu1, setMenu2 }; FICount = 0; foreach (SetMenu menu in menuList) { menu.setMenuId = FICount + 1; allSetMenus.Add(menu); FICount++; } // Order Order order1 = new Order(1, DateTime.Now); Payment payment1 = new Payment(1, DateTime.Now, "Online", order1); order1.payment = payment1; order1.orderItemList.Add(new OrderItem(1, 1, setMenu1)); order1.orderItemList.Add(new OrderItem(1, 2, foodItem1)); allOrders.Add(order1); //customer1.orderList.Add(order1); Order order2 = new Order(2, DateTime.Now); Payment payment2 = new Payment(2, DateTime.Now, "Online", order2); order2.payment = payment2; order2.orderItemList.Add(new OrderItem(1, 1, setMenu2)); order2.orderItemList.Add(new OrderItem(1, 2, foodItem2)); allOrders.Add(order2); //customer1.orderList.Add(order2); Order order3 = new Order(3, DateTime.Now); Payment payment3 = new Payment(3, DateTime.Now, "Online", order3); order3.payment = payment3; order3.orderItemList.Add(new OrderItem(1, 1, setMenu1)); order3.orderItemList.Add(new OrderItem(1, 2, foodItem3)); allOrders.Add(order3); customer1.orderList.Add(order3); Order order4 = new Order(4, DateTime.Now); Payment payment4 = new Payment(4, DateTime.Now, "Online", order4); order4.payment = payment4; order4.orderItemList.Add(new OrderItem(1, 1, setMenu1)); order4.orderItemList.Add(new OrderItem(1, 2, foodItem4)); order4.state = order4.preparingOrderState; allOrders.Add(order4); //customer1.orderList.Add(order4); } }
// Function 2 // Allow the manager to manage food items and menus, including adding/updating/deleting of food items and menus // Function 3 - Huilin // Allow a chef to select the order he wishes to prepare and update the order for dispatch once the order is ready public static void DisplayChefMenu(Chef chef) { while (true) { Console.WriteLine("Chef Menu"); Console.WriteLine("========="); Console.WriteLine("1 Prepare Order"); Console.WriteLine("2 Ready Order"); Console.WriteLine("0 Logout"); Console.Write("Please select an option: "); try { int option = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); // 1. Chef chooses Prepare Order if (option == 1) { // 2. System displays New Order(s) Console.WriteLine("Showing all New orders"); List <Order> orderByStateList = GetOrdersByState(new NewOrderState()); // 5. System displays Order information DisplayOrders(orderByStateList, new NewOrderState()); if (orderByStateList.Count > 0) { Console.Write("Select an order: "); int orderOption = -1; try { // 3. Chef selects an Order orderOption = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); // 4. System retrieves selected Order Order chosenOrder = GetOrderById(orderOption); if (chosenOrder == null) { Console.WriteLine("Invalid Order."); } else { // 5. System prompts to Confirm or Cancel changing Order Status to Preparing Console.WriteLine($"Change Order {orderOption} to Preparing?"); Console.WriteLine("1 Confirm"); Console.WriteLine("2 Cancel"); Console.Write("Select an option: "); int confirmOption = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); // 6. Chef selects Confirm if (confirmOption == 1) { // 7. System updates Order Status to Preparing // 8. System displays ‘Order Status changed to Preparing’ // 9. Use case ends chef.prepareOrder(chosenOrder); } // 6.1 Chef selects Cancel // 6.2 Use case ends else if (confirmOption == 2) { Console.WriteLine($"Cancelled changing Order {orderOption} to Preparing"); } else { Console.WriteLine("Please select a valid option!\n"); } } } // 3.1 System prompts to enter a valid Order // 3.2 System returns to Step 2 catch { Console.WriteLine("Please select a valid Order!\n"); } } } // 1. Chef chooses Dispatch Order else if (option == 2) { // 2. System displays Order(s) with ‘Preparing’ Status Console.WriteLine("Showing all Preparing orders"); List <Order> orderByStateList = GetOrdersByState(new PreparingOrderState()); DisplayOrders(orderByStateList, new PreparingOrderState()); if (orderByStateList.Count > 0) { Console.Write("Select an order: "); try { // 3. Chef selects an Order int orderOption = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); // 4. System retrieves selected Order Order chosenOrder = GetOrderById(orderOption); if (chosenOrder == null) { Console.WriteLine("Invalid Order."); } else { // 5. System prompts to Confirm or Cancel changing Order Status to ‘Ready’ Console.WriteLine($"Change Order {orderOption} to Ready?"); Console.WriteLine("1 Confirm"); Console.WriteLine("2 Cancel"); Console.Write("Select an option: "); int confirmOption = Int32.Parse(Console.ReadLine()); Console.WriteLine(""); // 6. Chef selects Confirm if (confirmOption == 1) { // 7. System updates Order Status to ‘Ready’ // 8. System displays ‘Order Status changed to Ready’ // 9. Use case ends chef.readyOrder(chosenOrder); } // 6.1 Chef chooses to cancel Status change // 6.2 Use case ends else if (confirmOption == 2) { Console.WriteLine($"Cancel changing Order {orderOption} to Ready"); } else { Console.WriteLine("Please select a valid option!"); } } } // 3.1 System prompts to enter a valid Order // 3.2 System returns to Step 2 catch { Console.WriteLine("Please select a valid order!"); } } } // Logout else if (option == 0) { break; } // Invalid option else { Console.WriteLine("Please select a valid option!"); } } catch { Console.WriteLine("Please select a valid option!"); } } }
// MANAGER SCREEN static void managerScreen(Manager m, List <Manager> mList) { List <Customer> customerList = new List <Customer>(); List <Receipt> rList = new List <Receipt>(); List <Chef> cList = new List <Chef>(); Chef c = new Chef(); List <Dispatcher> dList = new List <Dispatcher>(); Dispatcher d = new Dispatcher(); while (true) { Console.WriteLine("\n ======= MANAGER SCREEN ======="); Console.WriteLine("[1] View all manager details"); Console.WriteLine("[2] Manage Food & Menus"); Console.WriteLine("[3] Return to Employee Screen"); Console.Write("Select an option: "); string option = Console.ReadLine(); if (option == "1") { m.viewAllManagers(mList); } else if (option == "2") { while (true) { Console.WriteLine("\n ======= MANAGER SCREEN ======="); Console.WriteLine("[1] Add Food"); Console.WriteLine("[2] Edit Food"); Console.WriteLine("[3] Delete Food"); Console.WriteLine("[0] Back"); Console.WriteLine("Select Option:"); option = Console.ReadLine(); if (option == "1") // Add Food { while (true) { Console.WriteLine("Set Meal or À la Carte?"); Console.WriteLine("[1] Set Menu"); Console.WriteLine("[2] À la Carte?"); Console.WriteLine("[0] Cancel"); Console.WriteLine("\nSelect Option:"); string input = Console.ReadLine(); string foodType = ""; if ((input == "1" && mainMenu.HasNextFood()) || input == "2") // If input is valid { if (input == "1") { foodType = "Set Menu: "; } else { foodType = "À la Carte: "; } Console.WriteLine("Name of " + foodType); string newTitle = Console.ReadLine(); Console.WriteLine("Description of " + foodType); string newDesc = Console.ReadLine(); Console.WriteLine("Category of " + foodType); string newCat = Console.ReadLine(); input = ""; double newPrice; while (!double.TryParse(input, out newPrice)) // Check if input is valid { Console.WriteLine("Price of " + foodType); input = Console.ReadLine(); if (!double.TryParse(input, out newPrice)) { Console.WriteLine("Invalid Price!\n"); } } newPrice = Convert.ToDouble(input); Console.WriteLine("Unit of " + foodType); string newUnit = Console.ReadLine(); string newStatus = ""; while (newStatus != "1" && newStatus != "2") // Checck that input is only 1 or 2 { Console.WriteLine("Status of " + foodType); Console.WriteLine("[1] Available"); Console.WriteLine("[2] Unavailable"); Console.WriteLine("Select Option:"); newStatus = Console.ReadLine(); } List <string> statusList = new List <string> { "Available", "Unavailable" }; // If Set Menu selected if (foodType == "Set Menu: ") { int newSize = 0; input = ""; // Check if input is valid while (newSize <= 1 || newSize > 10 || !int.TryParse(input, out newSize)) { Console.WriteLine("Size of Set Meal:"); input = Console.ReadLine(); if (int.TryParse(input, out newSize)) // If input is int { newSize = Convert.ToInt32(input); if (newSize <= 1 || newSize > 10) // If input is not within range { Console.WriteLine("Size should be 2 to 10!"); } } else { Console.WriteLine("Size must be an integer!\n"); } } // Create New Set Meal as MenuItem object MenuItem newSetMenu = new MenuItem(globalFoodID, newTitle, newDesc, newCat, newPrice, newUnit, statusList[Convert.ToInt32(newStatus) - 1], true); globalFoodID++; // Display all A la Carte items for (int i = 0; i < newSize; i++) { try { // Display all A la Carte Console.WriteLine("========== Choose Food for " + newTitle + " ==========="); m1.displayAllFood(mainMenu, 2); Console.WriteLine("\n\nFood to Add:"); string idToAdd = Console.ReadLine(); // Add Food to New Set Menu Food foodToAdd = mainMenu.GetMenuItem(Convert.ToInt32(idToAdd)).FoodList[0]; newSetMenu.addFood(foodToAdd); Console.WriteLine("\n" + foodToAdd.Name + " Added!\n"); } catch { newSize += 1; Console.WriteLine("Invalid Selection!"); } } mainMenu.AddFood(newSetMenu); // Add set menu to main menu break; } // If À la Carte selected else { // Create New Food as MenuItem object MenuItem newMenuItem = new MenuItem(globalFoodID, newTitle, newDesc, newCat, newPrice, newUnit, statusList[Convert.ToInt32(newStatus) - 1], false); globalFoodID++; Food newFood = new Food(newTitle, newPrice); newMenuItem.addFood(newFood); mainMenu.AddFood(newMenuItem); // Add food to main menu break; } } else if (input == "1") { Console.WriteLine("You need at least 2 Food to creat a Set Menu!\n"); } else if (input == "0") // Return to previous screen { break; } else // Invalid input { continue; } } } else if (option == "2") // Edit Food { while (true) { // Display all existing Food Console.WriteLine("========== Existing Food ==========="); m1.displayAllFood(mainMenu, 0); Console.WriteLine("\n[0] Cancel"); Console.WriteLine("Note: Set Menus with Less than 2 items will not be displayed on the menu"); string input = ""; int selectedIndex; while (!int.TryParse(input, out selectedIndex)) // Check if input is int { Console.WriteLine("\nFood to Edit: "); input = Console.ReadLine(); if (!int.TryParse(input, out selectedIndex)) { Console.WriteLine("Invalid Option!\n"); } } if (selectedIndex != 0) // If Cancel option not selected { selectedIndex = Convert.ToInt32(input); bool isSetMenu; MenuItem foodToEdit = mainMenu.GetMenuItem(selectedIndex); if (foodToEdit.IsSetMenu == true) // If selected food is Set Menu { isSetMenu = true; } else // Else À la Carte { isSetMenu = false; } while (true) { Console.WriteLine("========= Options for " + foodToEdit.Title + " ========="); Console.WriteLine("[1] Edit Title"); Console.WriteLine("[2] Edit Description"); Console.WriteLine("[3] Edit Category"); Console.WriteLine("[4] Edit Price"); Console.WriteLine("[5] Edit Unit"); Console.WriteLine("[6] Change Status"); if (isSetMenu) // Show only if Set Menu selected { Console.WriteLine("[7] Edit Set Menu Contents"); } Console.WriteLine("[0] Back"); Console.WriteLine("\nSelect Option: "); input = Console.ReadLine(); // Store current values string currentTitle = foodToEdit.Title; if (input == "1") // Edit Title { Console.WriteLine("Current Title: " + currentTitle); Console.WriteLine("\nChange to:"); currentTitle = Console.ReadLine(); foodToEdit.Title = currentTitle; if (foodToEdit.IsSetMenu == false) { foodToEdit.FoodList[0].Name = currentTitle; } } else if (input == "2") // Edit Description { string currentDesc = foodToEdit.Description; Console.WriteLine("Current Description: " + currentDesc); Console.WriteLine("\nChange to:"); currentDesc = Console.ReadLine(); foodToEdit.Description = currentDesc; } else if (input == "3") // Edit Category { string currentCat = foodToEdit.Category; Console.WriteLine("Current Category: " + currentCat); Console.WriteLine("\nChange to:"); currentCat = Console.ReadLine(); foodToEdit.Category = currentCat; } else if (input == "4") // Edit Price { double currentPrice = foodToEdit.Price; string inputPrice = ""; while (!double.TryParse(inputPrice, out currentPrice)) // Check if input is valid { Console.WriteLine("Current Price: $" + currentPrice); Console.WriteLine("\nChange to: $"); inputPrice = Console.ReadLine(); if (!double.TryParse(inputPrice, out currentPrice)) { Console.WriteLine("Invalid Price!\n"); } } currentPrice = Convert.ToDouble(inputPrice); foodToEdit.Price = currentPrice; if (foodToEdit.IsSetMenu == false) { foodToEdit.FoodList[0].Price = currentPrice; } } else if (input == "5") // Edit Unit { string currentUnit = foodToEdit.Unit; Console.WriteLine("Current Unit: " + currentUnit); Console.WriteLine("\nChange to:"); currentUnit = Console.ReadLine(); foodToEdit.Unit = currentUnit; } else if (input == "6") // Change Status { string currentStatus = foodToEdit.Status; // Swap status if (foodToEdit.Status == "Available") { currentStatus = "Unavailable"; } else { currentStatus = "Available"; } foodToEdit.Status = currentStatus; Console.WriteLine("Status changed to \"" + currentStatus + "\""); } else if (input == "7" && isSetMenu) // Edit Set Menu Contents { Console.WriteLine("======= Choose Food to Remove from " + currentTitle + " ======="); foodToEdit.listFood(); Console.WriteLine("[0] Add Food Instead"); int optionToEdit; Console.WriteLine("\nFood to Edit:"); Console.WriteLine("Select Option:"); try { optionToEdit = Convert.ToInt32(Console.ReadLine()); if (optionToEdit != 0) // Remove Food { foodToEdit.removeFood(optionToEdit); } else // Add Food { Console.WriteLine("\n========== Add Food to " + currentTitle + " ==========="); // Display all À la Carte items m1.displayAllFood(mainMenu, 1); Console.WriteLine("\n\nFood to Add:"); try // Check if input is valid { int idToAdd = Convert.ToInt32(Console.ReadLine()); // Add Food to New Set Menu Food foodToAdd = mainMenu.GetMenuItem(idToAdd).FoodList[0]; foodToEdit.addFood(foodToAdd); Console.WriteLine("\n" + foodToAdd.Name + " Added!\n"); } catch { Console.WriteLine("Invalid Option!\n"); } } } catch { Console.WriteLine("Invalid Option!\n"); } } else if (input == "0") // Return to previous menu { break; } else { Console.WriteLine("Invalid Option!\n"); } } } else if (selectedIndex == 0) { break; } else { Console.WriteLine("\n"); } } } else if (option == "3") // Delete Food { if (mainMenu.GetCurrent() != null) { // Display all existing Food Console.WriteLine("========== Existing Food ==========="); Console.WriteLine(mainMenu.GetCurrent().NewToString(true)); while (mainMenu.HasNextFood()) { Console.WriteLine(mainMenu.NextFood().NewToString(true)); } Console.WriteLine("\n[0] Cancel"); Console.WriteLine("\nFood to Delete: "); try { int foodToDel = Convert.ToInt32(Console.ReadLine()); if (foodToDel != 0) // If Cancel option not selected { mainMenu.RemoveFood(foodToDel); } else { Console.WriteLine("\n"); } } catch { Console.WriteLine("Invalid Option!\n"); } } else { Console.WriteLine("No Existing Food!\n"); } } else if (option == "0") { employeeScreen(m, mList, c, cList, d, dList); } } } else if (option == "3") { employeeScreen(m, mList, c, cList, d, dList); } } }
// DISPATCHER SCREEN static void dispatcherScreen(Dispatcher d, List <Dispatcher> dList) { List <Manager> mList = new List <Manager>(); Manager m = new Manager(); List <Chef> cList = new List <Chef>(); Chef c = new Chef(); List <Customer> customerList = new List <Customer>(); List <Receipt> rList = new List <Receipt>(); while (true) { Console.WriteLine("\n ======= DISPATCHER SCREEN ======="); Console.WriteLine("[1] View all dispatcher details"); Console.WriteLine("[2] Dispatch an order"); Console.WriteLine("[3] Confirm a delivery"); Console.WriteLine("[4] Return to Employee Screen"); Console.Write("Select an option: "); string option = Console.ReadLine(); if (option == "1") { d.viewAllDispatchers(dList); } else if (option == "2") { if (oc.GetAllOrdersWhereState("ready").Count() != 0) { foreach (Order order in oc.GetAllOrdersWhereState("ready")) { Console.WriteLine(order.displayOrderDetails()); } Console.WriteLine("Dispatch an order: "); string input = Console.ReadLine(); d.dispatchOrder(oc.GetOrder(Convert.ToInt32(input))); } else { Console.WriteLine("\n You have no orders to dispatch!"); } } else if (option == "3") { if (oc.GetAllOrdersWhereState("dispatched").Count() != 0) { foreach (Order order in oc.GetAllOrdersWhereState("dispatched")) { Console.WriteLine(order.displayOrderDetails()); } Console.WriteLine("Confirm a delivery: "); string input = Console.ReadLine(); d.confirmDelivery(oc.GetOrder(Convert.ToInt32(input))); d.addCommission(oc.GetOrder(Convert.ToInt32(input)), d.TotalCommission); Console.WriteLine("\nTotal commission earned this month is now $" + d.TotalCommission); } else { Console.WriteLine("\n You have no orders that can be confirmed as delivered!"); } } else if (option == "4") { employeeScreen(m, mList, c, cList, d, dList); } } }