private void buttonDelete_Click(object sender, RoutedEventArgs e)
        {
            var selectedDoctor = this.GetSelectedDoctor();

            if (selectedDoctor == null)
            {
                return;
            }

            if (MessageBox.Show("Вы действительно хотите удалить этого врача?", "Подтверждение удаления", MessageBoxButton.OKCancel) != MessageBoxResult.OK)//messageboxresult System.Windows.Forms.DialogResult
            {
                return;
            }

            try
            {
                int doctorId = selectedDoctor.DoctorId;
                DoctorDataAccess.DeleteDoctorById(doctorId);
                this.Presenter.LoadAllDoctors();
            }
            catch (Exception ex)
            {
                string errorMessage = string.Format("При удалении объекта произошла ошибка!\n {0}", ex.Message);
                this.Message = errorMessage;
            }
        }
Example #2
0
 public Menu()
 {
     _doctorDataAccess                = new DoctorDataAccess();
     _patientDataAccess               = new PatientDataAccess();
     _timetableDataAccess             = new TimetableDataAccess();
     _doctorsSpecializationDataAccess = new DoctorsSpecializationDataAccess();
 }
Example #3
0
        //private Doctor GetSelectedDoctor()
        //{
        //    //var row = this.dataGridViewResult.SelectedItem;//currentrow было вместо колумна
        //    //if (row == null)
        //    //{
        //    //    return null;
        //    //}

        //    //var doctor = (Doctor)row;//row.DataBoundItem;
        //    //return doctor;
        //}

        private void buttonEdit_Click(object sender, RoutedEventArgs e)
        {
            var row        = (System.Data.DataRowView)dataGridViewResult.SelectedItems[0];
            var editDoctor = new EditDoctor(DoctorDataAccess.GetDoctorById(Convert.ToInt32(row.Row.ItemArray[0].ToString())));

            editDoctor.ShowDialog();
            //this.Presenter.LoadDoctorsByCriterias();
        }
Example #4
0
 private void buttonLoadDoctor_Click(object sender, RoutedEventArgs e)
 {
     Visit.Doctor = DoctorDataAccess.SelectDoctorByName(textBoxDoctorName.Text);
     if (Visit.Patient != null)
     {
         MessageBox.Show("Доктор найден");
     }
     else
     {
         MessageBox.Show("Доктор не найден, попробуйте еще раз");
     }
 }
Example #5
0
 public void Load(int doctorId)
 {
     try
     {
         if (doctorId == 0)
         {
             throw new ArgumentNullException("doctorId должен отличаться от 0!");
         }
         var doctor = DoctorDataAccess.GetDoctorById(doctorId);
         this.Doctor = doctor;
         this.FillView();
     }
     catch (Exception e)
     {
         string message = "Ошибка!:" + e.Message;
         View.Message = message;
     }
 }
        /// <summary>
        /// Filters doctors by name and number and sets the datagrdview source
        /// </summary>
        /// <param name="name"></param>
        /// <param name="number"></param>
        public void LoadDoctorsByCriterias(string name)
        {
            try
            {
                IQueryable <Doctor> doctorsQuery;
                doctorsQuery = DoctorDataAccess.GetDoctors();
                if (!string.IsNullOrEmpty(name))
                {
                    doctorsQuery = doctorsQuery.Where(d => d.Name.Contains(name));
                }


                this.Doctors = doctorsQuery.ToList();
            }
            catch (Exception e)
            {
                this.Message = "Ошибка при запросе базы данных! Вызовите администратора!\n" + e.Message;
            }
        }
Example #7
0
        protected void FillView()
        {
            int doctorId = Diagnosis.DoctorId.HasValue ? Diagnosis.DoctorId.Value : 0;

            View.DoctorId = doctorId;
            var consultationDoctor = DoctorDataAccess.GetDoctorById(doctorId);

            if (consultationDoctor != null)
            {
                View.DoctorName = consultationDoctor.Name;
            }
            else
            {
                View.DoctorName = "Не выбран врач";
            }


            int patientId = Diagnosis.PatientId.HasValue ? Diagnosis.PatientId.Value : 0;

            View.PatientId = patientId;
            var consultationPatient = PatientsDataAccess.GetPatientById(patientId);

            if (consultationPatient != null)
            {
                View.PatientName   = consultationPatient.Name;
                View.PatientNumber = consultationPatient.Number;
            }
            else
            {
                View.PatientName   = "Не выбран пациент";
                View.PatientNumber = string.Empty;
            }

            DateTime scheduleDate = Diagnosis.DiagnosticationDate.HasValue ? Diagnosis.DiagnosticationDate.Value : DateTime.Now;

            View.DiagnosticationDate = scheduleDate;

            View.Notes        = Diagnosis.Notes;
            View.Subject      = Diagnosis.Subect;
            View.Prescription = Diagnosis.Prescription;
            View.DiagnoseId   = Diagnosis.DiagnoseId;
        }
Example #8
0
 private void SaveModel(Doctor model)
 {
     try
     {
         if (Doctor.DoctorId == 0)
         {
             DoctorDataAccess.InsertDoctor(Doctor);
         }
         else
         {
             DoctorDataAccess.UpdateDoctor(Doctor);
         }
         View.Message = "Успешная запись!";
     }
     catch (Exception e)
     {
         var message = String.Format("Ошибка хранилища!Позвоните администратору!/ n [0] ", e.Message);
         View.Message = message;
     }
 }
Example #9
0
        protected bool IsDataValid(out string message)
        {
            message = string.Empty;
            bool   isValid = true;
            string _regex  = @"\d{12}";

            if (String.IsNullOrEmpty(textBoxName.Text))
            {
                message += String.Format("Поле '{0}' пусто!\n", "Имя");
                isValid  = false;
            }
            if (String.IsNullOrEmpty(textBoxAddress.Text))
            {
                message += String.Format("Поле '{0}' пусто!\n", "Адрес");
                isValid  = false;
            }
            //if (String.IsNullOrEmpty(Doctor.Skils))
            //{
            //    message += String.Format("Поле '{0}' пусто!\n", "Опыт");
            //    isValid = false;
            //}
            if (!Regex.IsMatch(textBoxPhone.Text, _regex))
            {
                message += String.Format("Неверный формат телефона");
                isValid  = false;
            }
            Doctor.Name    = textBoxName.Text;
            Doctor.Phone   = textBoxPhone.Text;
            Doctor.Address = textBoxAddress.Text;
            Category       category       = new Category(DoctorDataAccess.SelectCatIdByCat(textBoxCat.SelectedValue.ToString()), textBoxCat.SelectedValue.ToString());
            Specialization specialization = new Specialization(DoctorDataAccess.SelectSpecIdByName(textBoxSpec.Text), textBoxSpec.Text);

            Doctor.Category1       = category;
            Doctor.Specialization1 = specialization;

            return(isValid);
        }
Example #10
0
        protected void FillView()
        {
            int doctorId = Consultation.DoctorId.HasValue ? Consultation.DoctorId.Value : 0;
            View.DoctorId = doctorId;
            var consultationDoctor = DoctorDataAccess.GetDoctorById(doctorId);
            if (consultationDoctor != null)
            {
                View.DoctorName = consultationDoctor.Name;
            }
            else
            {
                View.DoctorName = "Не выбран пациент";
            }

            int patientId = Consultation.PatientId.HasValue ? Consultation.PatientId.Value : 0;
            View.PatientId = patientId;
            var consultationPatient = PatientsDataAccess.GetPatientById(patientId);
            if (consultationPatient != null)
            {
                View.PatientName = consultationPatient.Name;
                View.PatientNumber = consultationPatient.Number;
            }
            else
            {
                View.PatientName = "Не выбран пациент";
                View.PatientNumber = string.Empty;
            }

            DateTime scheduleDate = Consultation.ScheduleDate.HasValue ? Consultation.ScheduleDate.Value : DateTime.Now;
            TimeSpan scheduleTime = Consultation.ScheduleTime.HasValue ? Consultation.ScheduleTime.Value : TimeSpan.MinValue;
            View.ScheduleDate = scheduleDate;
            View.ScheduleTime = scheduleTime;
            View.Notes = Consultation.Notes;
            View.Reason = Consultation.Reason;
            View.Conclusion = Consultation.Conclusion;
            View.ConsultationId = Consultation.ConsultationId;
        }
Example #11
0
 private void buttonSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Category.SelectedItem != null && Category.SelectedItem.ToString() != "")
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctorsByCat(Category.SelectedItem.ToString());
             return;
         }
         if (!String.IsNullOrEmpty(Spec.Text))
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctorsBySpec(Spec.Text);
             return;
         }
         if (Category.SelectedItem.ToString() == "" && String.IsNullOrEmpty(Spec.Text))
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctors();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #12
0
 public DoctorBusiness()
 {
     _doctorDataMapper     = new DoctorDataAccess();
     _policlinicDataMapper = new PoliclinicDataMapper();
 }
Example #13
0
        //public ConsultationsPresenter Presenter { get; set; }



        private void buttonSearch_Click(object sender, RoutedEventArgs e)
        {
            dataGridViewResult.Columns.Clear();
            List <Visit> visits = new List <Visit>();

            if (Membership.CurrentUser.RoleID == 1)
            {
                for (int i = 0; i < VisitsDataAccess.GetVisits().Count; i++)
                {
                    var row = VisitsDataAccess.GetVisits()[i];
                    visits.Add(new Visit(Convert.ToInt32(row.Row.ItemArray[0]),
                                         DoctorDataAccess.GetDoctorByName(row.Row.ItemArray[1].ToString()),
                                         PatientsDataAccess.GetPatientByName(row.Row.ItemArray[2].ToString()),
                                         Convert.ToDateTime(row.Row.ItemArray[3]),
                                         VisitsDataAccess.GetTypeByName(row.Row.ItemArray[4].ToString()),
                                         row.Row.ItemArray[5].ToString(),
                                         row.Row.ItemArray[6].ToString(),
                                         row.Row.ItemArray[7].ToString(),
                                         row.Row.ItemArray[8].ToString(),
                                         new Room(row.Row.ItemArray[9].ToString(), null),
                                         (row.Row.ItemArray[10].ToString() == "") ? null : (byte[])row.Row.ItemArray[10]
                                         ));
                }
            }
            else if (Membership.CurrentUser.RoleID == 2)
            {
                for (int i = 0; i < VisitsDataAccess.GetVisitsByDoctorId(Membership.CurrentUser.Doctor.Id).Count; i++)
                {
                    var row = VisitsDataAccess.GetVisitsByDoctorId(Membership.CurrentUser.Doctor.Id)[i];
                    visits.Add(new Visit(Convert.ToInt32(row.Row.ItemArray[0]),
                                         DoctorDataAccess.GetDoctorByName(row.Row.ItemArray[1].ToString()),
                                         PatientsDataAccess.GetPatientByName(row.Row.ItemArray[2].ToString()),
                                         Convert.ToDateTime(row.Row.ItemArray[3]),
                                         VisitsDataAccess.GetTypeByName(row.Row.ItemArray[4].ToString()),
                                         row.Row.ItemArray[5].ToString(),
                                         row.Row.ItemArray[6].ToString(),
                                         row.Row.ItemArray[7].ToString(),
                                         row.Row.ItemArray[8].ToString(),
                                         new Room(row.Row.ItemArray[9].ToString(), null),
                                         (row.Row.ItemArray[10].ToString() == "") ? null : (byte[])row.Row.ItemArray[10]
                                         ));
                }
            }
            dataGridViewResult.AutoGenerateColumns = false;

            DataGridTextColumn id = new DataGridTextColumn();

            id.Header  = "ID";
            id.Binding = new Binding("ID");
            dataGridViewResult.Columns.Add(id);

            DataGridTextColumn doctor = new DataGridTextColumn();

            doctor.Header  = "Доктор";
            doctor.Binding = new Binding("Doctor.Name");
            dataGridViewResult.Columns.Add(doctor);

            DataGridTextColumn patient = new DataGridTextColumn();

            patient.Header  = "Пациент";
            patient.Binding = new Binding("Patient.Name");
            dataGridViewResult.Columns.Add(patient);

            DataGridTextColumn datetime = new DataGridTextColumn();

            datetime.Header  = "Дата/время";
            datetime.Binding = new Binding("DateTime");
            dataGridViewResult.Columns.Add(datetime);

            DataGridTextColumn type = new DataGridTextColumn();

            type.Header  = "Тип";
            type.Binding = new Binding("Type.Type");
            dataGridViewResult.Columns.Add(type);

            DataGridTextColumn sympthoms = new DataGridTextColumn();

            sympthoms.Header  = "Симптомы";
            sympthoms.Binding = new Binding("Symthoms");
            dataGridViewResult.Columns.Add(sympthoms);

            DataGridTextColumn diagnosis = new DataGridTextColumn();

            diagnosis.Header  = "Диагноз";
            diagnosis.Binding = new Binding("Diagnosis");
            dataGridViewResult.Columns.Add(diagnosis);

            DataGridTextColumn prescription = new DataGridTextColumn();

            prescription.Header  = "Назначения";
            prescription.Binding = new Binding("Prescription");
            dataGridViewResult.Columns.Add(prescription);

            DataGridTextColumn notes = new DataGridTextColumn();

            notes.Header  = "Заметки";
            notes.Binding = new Binding("Notes");
            dataGridViewResult.Columns.Add(notes);

            DataGridTextColumn room = new DataGridTextColumn();

            room.Header  = "Кабинет";
            room.Binding = new Binding("Room.Number");
            dataGridViewResult.Columns.Add(room);

            IEnumerable <Visit> result = visits;

            if (dateTimePickerFrom.SelectedDate != null)
            {
                result = result.Where(el => (el.DateTime > dateTimePickerFrom.SelectedDate)).Select(el => el);
            }
            if (dateTimePickerTo.SelectedDate != null)
            {
                result = result.Where(el => (el.DateTime < dateTimePickerTo.SelectedDate)).Select(el => el);
            }
            if (!String.IsNullOrEmpty(Patient.Text))
            {
                result = result.Where(el => (el.Patient.Name.Contains(Patient.Text))).Select(el => el);
            }
            if (!String.IsNullOrEmpty(Doctor.Text))
            {
                result = result.Where(el => (el.Doctor.Name.Contains(Doctor.Text))).Select(el => el);
            }
            if (!String.IsNullOrEmpty(Diagnosis.Text))
            {
                result = result.Where(el => (el.Diagnosis.Contains(Patient.Text))).Select(el => el);
            }
            if (VisitType.SelectedItem != null && VisitType.SelectedItem.ToString() != "")
            {
                result = result.Where(el => (el.Type.Type == VisitType.SelectedItem.ToString())).Select(el => el);
            }
            dataGridViewResult.ItemsSource = result;
            SelectFlag = true;
        }
Example #14
0
 private void SelectAllDoctors()
 {
     dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctors();
     //throw new NotImplementedException();
 }
Example #15
0
 public Menu()
 {
     _patientDataAccess  = new PatientDataAccess();
     _doctorDataAccess   = new DoctorDataAccess();
     _scheduleDataAccess = new ScheduleDataAccess();
 }
Example #16
0
        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);
        }
Example #17
0
        static void Main(string[] args)
        {
            ConfigurationService.Init();
            ICollection <Doctor>       doctors;
            ICollection <VisitHistory> visitTime;

            using (var doctorDataAccess = new DoctorDataAccess())
            {
                doctors = doctorDataAccess.Select();
            }
            Console.WriteLine(@"                                *********************************************
                                *			                    *
                                *			                    *
                                *       Welcome to the Hospital System!     *
                                *			                    *
                                *			                    *
                                *********************************************");
            var patient = new Patient();

            while (true)
            {
                Console.Write("Enter your Full name:\n");
                using (var patientDataAccess = new PatientDataAccess())
                {
                    patient.FullName = Console.ReadLine();
                    patientDataAccess.Insert(patient);
                    visitTime = patientDataAccess.SelectVisitTime();
                }
                Console.Clear();

                Console.Write("\n1. Sign up for an appointment\n\n0. Exit\nChoose: ");
                switch (Console.ReadLine())
                {
                case "1":
                    Console.Write("Choose doctor's direction: \n");
                    var direction = Console.ReadLine();
                    foreach (var doctor in doctors)
                    {
                        if (doctor.Direction.Name.Contains(direction))
                        {
                            using (var patientDataAccess = new PatientDataAccess())
                            {
                                foreach (var date in visitTime)
                                {
                                    if (date.DoctorId == doctor.Id && date.VisitDate.Hour <= DateTime.Now.Hour)
                                    {
                                        doctor.IsFree = true;
                                    }
                                }
                                if (doctor.Schedule.StartTime.Hour >= DateTime.Now.Hour &&
                                    (doctor.Schedule.EndTime.Hour - 1) <= DateTime.Now.Hour &&
                                    doctor.IsFree == true)
                                {
                                    patientDataAccess.InsertHistory(doctor, patient);
                                }
                            }
                        }
                    }
                    break;

                case "0":
                    return;
                }
            }
        }
Example #18
0
        static void Main(string[] args)
        {
            var nowDay            = new DateTime(2021, 3, 19, 8, 0, 0);
            var fullTimeToRecords = new List <DayRecords>
            {
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay,
                    RecordsDateTimeEnd   = nowDay.AddMinutes(30)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(30),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(60)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(60),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(90)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(90),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(120)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(120),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(150)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(150),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(180)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(180),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(210)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(210),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(240)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(240),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(270)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(270),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(300)
                },
                new DayRecords
                {
                    RecordsDateTimeStart = nowDay.AddMinutes(300),
                    RecordsDateTimeEnd   = nowDay.AddMinutes(330)
                },
            };

            InitConfiguration();
            var user = new User
            {
                Id       = new Guid("6b017401-fd94-4710-8bf8-f9e0b40803a2"),
                Login    = "******",
                Password = "******",
                FullName = "Человечкова Алина Кадаржановна",
                IIN      = "12345678987"
            };

            Console.WriteLine("1.понедельник\n2.вторник\n3.среда\n4.четверг\n5.пятница");
            Console.Write("Введите день недели для записи: ");
            var day   = Console.ReadLine();
            Day dayId = new Day();

            switch (day)
            {
            case "1":
                dayId.Id = new Guid("d0e91b3a-9ead-4c96-b69e-82b8420c8b4f");
                break;
            }

            var dayRecords = new List <DayRecords>();

            using (var recordDataAccess = new RecordDataAccess())
            {
                dayRecords = recordDataAccess.GetDayRecords(dayId.Id).ToList();
            }

            Console.WriteLine("Занятое время");
            foreach (var rec in dayRecords)
            {
                fullTimeToRecords.Remove(rec);
            }

            var record = new Record();

            record.Id     = Guid.NewGuid();
            record.UserId = user.Id;

            Console.WriteLine("Введите номер врача: ");
            var doctors  = new List <Doctor>();
            int chetchik = 1;

            using (var doctorDataAccess = new DoctorDataAccess())
            {
                doctors = doctorDataAccess.SelectAllDoctors().ToList();
                foreach (var doctor in doctors)
                {
                    doctor.Specialization = doctorDataAccess.GetSpecialization(doctor.SpecializationId);
                    Console.WriteLine($"{chetchik++}. {doctor.FullName} {doctor.Specialization.Specialty}");
                }
            }

            var doctorNum = int.Parse(Console.ReadLine());

            switch (doctorNum)
            {
            case 1:
                record.DoctorId = doctors[doctorNum - 1].Id;
                break;
            }



            Console.WriteLine("Введите время для записи");
            int i = 1;

            foreach (var dayrecord in fullTimeToRecords)
            {
                Console.WriteLine($"{i++}. {dayrecord.RecordsDateTimeStart.TimeOfDay} | {dayrecord.RecordsDateTimeEnd.TimeOfDay}");
            }
            var timeToRecords = int.Parse(Console.ReadLine());

            switch (timeToRecords)
            {
            case 1:
                record.RecordDateTimeStart = fullTimeToRecords[timeToRecords - 1].RecordsDateTimeStart;
                record.RecordDateTimeEnd   = fullTimeToRecords[timeToRecords - 1].RecordsDateTimeEnd;
                break;
            }

            using (var recorddata = new RecordDataAccess())
            {
                recorddata.Insert(record);
            }
        }