public static void Run(string[] info) { if (info.Length == 1) { Console.WriteLine (string.Join("\n", HospitalDepartments.ShowDepartments()[info[0]] .Where(x => x.Count > 0) .SelectMany(x => x.ToArray().Select(p => p.Name)))); } else if (info.Length == 2 && int.TryParse(info[1], out int room)) { var ss = HospitalDepartments .ShowDepartments()[info[0]][room - 1].Select(x => x.Name).OrderBy(x => x); Console.WriteLine (string.Join("\n", HospitalDepartments .ShowDepartments()[info[0]][room - 1] .Select(x => x.Name).OrderBy(x => x))); } else { var name = info[0] + info[1]; Console.WriteLine (string.Join("\n", HospiyalDoctors .ShowDoctors()[name].Select(x => x.Name) .OrderBy(x => x))); } }
public static void Main() { string command = Console.ReadLine(); while (command != "Output") { string[] hospitalInfo = command.Split(); var departament = hospitalInfo[0]; Department department = new Department(departament); var purvoIme = hospitalInfo[1]; var vtoroIme = hospitalInfo[2]; Doctor doctor = new Doctor(purvoIme, vtoroIme); var pacient = hospitalInfo[3]; Patient patient = new Patient(pacient); HospiyalDoctors.AddDoctor(doctor); HospiyalDoctors.AddPatients(doctor.FullName, patient); HospitalDepartments.AddDepartment(department); HospitalDepartments.AddPatientInDepartment(department.Name, patient); command = Console.ReadLine(); } command = Console.ReadLine(); while (command != "End") { string[] info = command.Split(" ", StringSplitOptions.RemoveEmptyEntries); PrintHospitalStatistik.Run(info); command = Console.ReadLine(); } }