public static void addEmployeeCommand(Fabric fabric) { Console.Clear(); Console.WriteLine("Add employee ==================================================================="); Console.Write("Enter employee name: "); string name = Console.ReadLine(); if (name.Equals("")) { Console.Clear(); Console.WriteLine("Invalid name. Press any key to return to the main menu"); Console.ReadKey(); return; } Console.Write("Enter employee age: "); int age = int.Parse(Console.ReadLine()); if (age < 18) { Console.Clear(); Console.WriteLine("Invalid age. Press any key to return to the main menu"); Console.ReadKey(); return; } Employee employee = new Employee(); employee.setInfo(name, age); Console.Write("Enter employee store: "); name = Console.ReadLine(); if (name.Equals("")) { Console.Clear(); Console.WriteLine("Invalid name. Press any key to return to the main menu"); Console.ReadKey(); return; } if (fabric.getStore(name) == null) { Console.Clear(); Console.WriteLine("Store not found. Press any key to return to the main menu"); Console.ReadKey(); return; } fabric.getStore(name).addEmployee(employee); Console.WriteLine("Employee added. Press any key to return to the main menu"); }
private static void addStoreCommand(Fabric fabric) { Console.Clear(); Console.WriteLine("Add store ======================================================================"); Console.Write("Enter the store name: "); string name = Console.ReadLine(); if (name.Equals("")) { Console.Clear(); Console.WriteLine("Invalid name. Press any key to return to the main menu"); Console.ReadKey(); return; } if (fabric.getStore(name) != null) { Console.Clear(); Console.WriteLine("Store " + name + " already exists. Press any key to return to the main menu"); Console.ReadKey(); return; } Store store = new Store(); store.setName(name); fabric.addStore(store); Console.WriteLine("Store added. Press any key to return to the main menu"); }