public void MainMenu() { var isEnd = false; Console.Write("Введите ваше полное имя (И.В.Петров): "); var fullName = Console.ReadLine(); Console.Write("Введите вашу дату рождения (2020-12-31): "); var birthDate = DateTime.Parse(Console.ReadLine()); _patient = new Patient { FullName = fullName, BirthDate = birthDate }; if (_patientDataAccess.Select().Where(patient => patient.FullName == fullName && patient.BirthDate == birthDate).ToList().Count == 0) { _patientDataAccess.Insert(_patient); } while (!isEnd) { Console.Clear(); ShowMenu("-------------Главное меню------------", "Посмотреть свои записи", "Записаться на прием", "Закрыть"); Console.Write("Ваш выбор: "); if (!int.TryParse(Console.ReadLine(), out int choice)) { ThrowError("Некорректный ввод!"); } switch (choice) { case 1: ShowOwnAppointments(); break; case 2: ShowDoctors(); break; case 3: isEnd = true; break; default: ThrowError("Такого пункта нет!"); break; } } }
static void Main(string[] args) { InitConfiguration(); CultureInfo enUS = new CultureInfo("en-US"); var doctors = new List <Doctor> { new Doctor { FullName = "Ivan Ivanov", SpecialId = Guid.Parse("6E5D08FA-9E66-4639-9742-06F9DF4197A7"), ScheduleId = Guid.Parse("A30B3F5A-7744-4B6D-B99A-1D15848A5B3A"), }, new Doctor { FullName = "Boris Borisov", SpecialId = Guid.Parse("627CEDC2-530D-4B35-9BEB-08E3B7E07F79"), ScheduleId = Guid.Parse("37D70B5B-4F33-4D07-B834-211C40C3C5EE") } }; var patients = new List <Patient> { new Patient { FullName = "Ivan Ivanov", TimeOfVisitId = Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37") }, new Patient { FullName = "Boris Borisov", TimeOfVisitId = Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B") } }; var visits = new List <TimesToVisits> { new TimesToVisits { Id = Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B"), TimeOfVisit = DateTime.ParseExact("11:00", "HH:mm", enUS) }, new TimesToVisits { Id = Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37"), TimeOfVisit = DateTime.ParseExact("15:00", "HH:mm", enUS) }, }; var scheduls = new List <Schedule> { new Schedule { Id = Guid.Parse("A30B3F5A-7744-4B6D-B99A-1D15848A5B3A"), TimesOfVisitsId = new List <Guid> { Guid.Parse("D8E21FB5-EBF6-45AD-AC09-59123ED3389B") } }, new Schedule { Id = Guid.Parse("37D70B5B-4F33-4D07-B834-211C40C3C5EE"), TimesOfVisitsId = new List <Guid> { Guid.Parse("8E070ED1-E5B1-4BC5-8176-39B4C53FBD37") } } }; var therapist = new Special { Id = Guid.Parse("6E5D08FA-9E66-4639-9742-06F9DF4197A7"), Name = "Терапевт" }; var surgeon = new Special { Id = Guid.Parse("627CEDC2-530D-4B35-9BEB-08E3B7E07F79"), Name = "Хирург" }; var doctorAccess = new DoctorDataAccess(); var listOfDoc = doctorAccess.Select().ToList(); Console.WriteLine("Выберите врача"); var choose = new List <int>(); int number = 0; foreach (var doc in listOfDoc) { choose.Add(number); Console.Write(doc.FullName); Console.Write(" - "); Console.WriteLine(choose[number]); } int.TryParse(Console.ReadLine(), out int numberOfDoc); var scheduleAccess = new ScheduleDataAccess(); var listOfSchedules = scheduleAccess.Select().ToList(); var visitAccess = new TimesToVisitsDataAccess(); var listOfVisits = visitAccess.Select().ToList(); choose = null; number = 0; Doctor DocOfPatient = null; foreach (var doc in doctors) { choose.Add(number); if (numberOfDoc == choose[number]) { DocOfPatient = doc; } foreach (var schedule in listOfSchedules) { if (schedule.Id == DocOfPatient.ScheduleId && schedule.TimesOfVisitsId == listOfVisits[number]) { Console.WriteLine(visits[number]); } } } int.TryParse(Console.ReadLine(), out int numberOfVisit); var patientAccess = new PatientDataAccess(); var listOfPatient = patientAccess.Select().ToList(); Console.WriteLine("Введите имя"); string nameOfPatient = Console.ReadLine(); var newPatient = new Patient { FullName = nameOfPatient, TimeOfVisitId = }; listOfPatient.Add(newPatient); }