public static void LineManagement() /// <summary> /// A method to manage MamaSuperMarket queue. /// </summary> /// <param name="CustQueue"> /// A reference to the supermarket queue in the program /// </param> { // System client options menu StringBuilder sb = new StringBuilder(); sb.AppendLine(); sb.AppendLine(); sb.AppendLine("Welcome to MamaSuperMarket Line. What would you like to do?"); sb.AppendLine(); sb.AppendLine("1 - Append a customer to the line"); sb.AppendLine("2 - Insert multiple customers to the supermarket"); sb.AppendLine("3 - Watch who in the line"); sb.AppendLine("4 - Go back to main menu"); Console.WriteLine(sb.ToString()); int choice = 5; // default value for the choice (if client`s input is wrong, program will get into the loop and give him another try) Console.Write("Your choice: "); string string_choice = Console.ReadLine(); // input for client`s choice try { choice = int.Parse(string_choice); } // trying to parse client`s choice to int catch { } // if client`s input is wrong, keeps choice as 5 while (choice != 4) { switch (choice) { case 1: SuperMarketQueueBL.AppendCustomerToLine(); break; case 2: Console.Write("Customers to insert: "); string string_count = Console.ReadLine(); try { int count = int.Parse(string_count); SuperMarketQueueBL.InsertMultipleCustomersToSuperMarket(count); } catch { Console.WriteLine("Wrong input!"); } break; case 3: SuperMarketQueueBL.CustomersInTheLine(); break; case 4: return; default: Console.WriteLine("Choice doesn`t exist, please try again."); break; } sb = new StringBuilder(); sb.AppendLine(); sb.AppendLine(); sb.AppendLine("Welcome to MamaSuperMarket Line. What would you like to do?"); sb.AppendLine(); sb.AppendLine("1 - Append a customer to the line"); sb.AppendLine("2 - Insert multiple customers to the supermarket"); sb.AppendLine("3 - Watch who in the line"); sb.AppendLine("4 - Go back to main menu"); Console.WriteLine(sb.ToString()); Console.Write("Your choice: "); string_choice = Console.ReadLine(); try { choice = int.Parse(string_choice); } catch { choice = 5; } Console.Clear(); } Console.WriteLine("Press any key to continue. Bye bye."); }
/// <summary> /// The method creates 3 Employees, 6 Customers, 4 Cash Registers, 6 Product types and many products. /// </summary> public static void CreateObjectsForDebug() { CashRegister CRegister1 = new CashRegister("1"); CashRegister CRegister2 = new CashRegister("2"); CashRegister CRegister3 = new CashRegister("3"); CashRegister CRegister4 = new CashRegister("4"); Console.WriteLine("Cash reg created"); ProductType Yogo = new ProductType("Yogurt", 6.99, "111"); Inventory.Instance.AddProductType(Yogo); ProductType Koteg = new ProductType("Koteg", 7.99, "222"); Inventory.Instance.AddProductType(Koteg); ProductType Antrikot = new ProductType("Antrikot", 129.99, "333"); Inventory.Instance.AddProductType(Antrikot); ProductType Tea = new ProductType("Tea Box", 25.00, "444"); Inventory.Instance.AddProductType(Tea); ProductType Tomatoes = new ProductType("Tomatoes", 3.99, "555"); Inventory.Instance.AddProductType(Tomatoes); ProductType Zero = new ProductType("Coca Cola Zero", 2.99, "666"); Inventory.Instance.AddProductType(Zero); Console.WriteLine("Product Types Created"); Customer c1 = new Customer("Amit Assa", "11", 36.5, true, false); SuperMarketQueueBL.GetInLine(c1); CustomerHandler.GenerateRandomShoppingList(c1); Customer c2 = new Customer("Dana Assa", "12", 34.5, true, false); SuperMarketQueueBL.GetInLine(c2); CustomerHandler.GenerateRandomShoppingList(c2); Customer c3 = new Customer("Dor Assa", "13", 37.2, false, true); SuperMarketQueueBL.GetInLine(c3); CustomerHandler.GenerateRandomShoppingList(c3); Customer c4 = new Customer("Chen Assa", "14", 38.3, true, false); SuperMarketQueueBL.GetInLine(c4); Customer c5 = new Customer("Mike Assa", "15", 36.0, true, true); SuperMarketQueueBL.GetInLine(c5); CustomerHandler.GenerateRandomShoppingList(c5); Customer c6 = new Customer("Shay Assa", "16", 32.1, true, false); SuperMarketQueueBL.GetInLine(c6); CustomerHandler.GenerateRandomShoppingList(c6); Console.WriteLine("Customers Created"); Employee emp = new Employee("Yossi", "999"); Employee emp2 = new Employee("Tanya", "998"); Employee emp3 = new Employee("Lily", "997"); Console.WriteLine("Employees created"); CreateProductsDebug(); }