Ejemplo n.º 1
0
 private void diseaseBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!(diseaseBox.SelectedItem is null))
     {
         selectDisease = diseaseBox.SelectedItem as Disease;
         HospitalManager.GetInstance().TreatmentService.FilterByDisease(selectDisease.Id, true);
     }
 }
Ejemplo n.º 2
0
 private void DoctorGridView_SelectionChanged(object sender, EventArgs e)
 {
     if (DoctorGridView.SelectedRows.Count > 0)
     {
         int doctorId = (int)DoctorGridView.SelectedRows[0].Cells["Id"].Value;
         _doctor = HospitalManager.GetInstance().EmployeeService.FindById(doctorId);
         profileBindingSource.DataSource = _doctor;
     }
 }
Ejemplo n.º 3
0
 private void searchDoctorBox_TextChanged(object sender, EventArgs e)
 {
     removeSorted.PerformClick();
     if (string.IsNullOrWhiteSpace(searchDoctorBox.Text))
     {
         HospitalManager.GetInstance().EmployeeService.FilterByRole(UserRole.Врач, true);
     }
     else
     {
         HospitalManager.GetInstance().EmployeeService.FilterByName(UserRole.Врач, searchDoctorBox.Text, true);
     }
 }
Ejemplo n.º 4
0
 private void AddOrdEditVisitForm_Load(object sender, EventArgs e)
 {
     patientBox.Text = _patient.FullName;
     BindingDoctor();
     if (!(_visit is null))
     {
         createButton.Text = "Изменить";
         idLabel.Text      = _visit.Id.ToString();
         dateBox.Value     = _visit.Date;
         timeBox.Value     = new DateTime(_visit.Date.Year, _visit.Date.Month, _visit.Date.Day, _visit.Time.Hours, _visit.Time.Minutes, _visit.Time.Seconds);
         patientBox.Text   = HospitalManager.GetInstance().VisitService.GetPatient(_visit.Patient).FullName;
         doctorBox.Text    = HospitalManager.GetInstance().VisitService.GetDoctore(_visit.Doctor).FullName;
     }
 }
Ejemplo n.º 5
0
 private void createButton_Click(object sender, EventArgs e)
 {
     try
     {
         HospitalManager.GetInstance().EmployeeService.AddElement(new Employee(
                                                                      loginBox.Text, passwordBox.Text, (UserRole)roleBox.SelectedItem, nameBox.Text, surnameBox.Text,
                                                                      (Genders)genderBox.SelectedItem, phoneBox.Text, dateBox.Value.Date,
                                                                      (UserPriority)priorityBox.SelectedItem));
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
        private void BindingDoctor()
        {
            DoctorGridView.AutoGenerateColumns = false;
            AddColumnDoctor();

            profileBindingSource.DataSource = typeof(Employee);

            DoctorSource.DataSource = HospitalManager.GetInstance().EmployeeService.GetElement();
            DoctorSource.RemoveFilter();
            HospitalManager.GetInstance().EmployeeService.FilterByRole(UserRole.Врач, true);
            DoctorNavigator.BindingSource = DoctorSource;
            DoctorGridView.DataSource     = DoctorSource;

            viewProfile_CheckedChanged(null, null);
            AddBindingDataDoctor();
        }
Ejemplo n.º 7
0
 public AddOrdEditVisitForm(Patient customer, Visit visit = default)
 {
     InitializeComponent();
     if (visit is null)
     {
         if (customer is null)
         {
             throw new ArgumentException("Ошибка привязки пациента");
         }
         _patient = customer;
     }
     else
     {
         _visit   = visit;
         _patient = HospitalManager.GetInstance().VisitService.GetPatient(_visit.Patient);
     }
 }
Ejemplo n.º 8
0
        private void AddOrEditDiagnosisForm_Load(object sender, EventArgs e)
        {
            TreatmentSource.DataSource = HospitalManager.GetInstance().TreatmentService.GetElement();
            treatmentBox.DataSource    = TreatmentSource;

            diseaseBox.DataSource = HospitalManager.GetInstance().DiseaseService.GetElement().OriginalList;

            patientBox.Text = _patient.FullName;
            doctorBox.Text  = _doctor.FullName;
            dateBox.Text    = DateTime.Today.ToLongDateString();

            if (!(_diagnosis is null))
            {
                createButton.Text         = "Изменить";
                diseaseBox.SelectedItem   = HospitalManager.GetInstance().DiagnosisService.GetDisease(_diagnosis.DiseaseID);
                treatmentBox.SelectedItem = HospitalManager.GetInstance().DiagnosisService.GetTreatment(_diagnosis.TreatmentID);
            }
        }
Ejemplo n.º 9
0
        private void createButton_Click(object sender, EventArgs e)
        {
            try
            {
                Diagnosis diagnosis = new Diagnosis(_patient.Id, _doctor.Id, selectDisease.Id, selectTreatment.Id, DateTime.Parse(dateBox.Text));

                if (_diagnosis is null)
                {
                    HospitalManager.GetInstance().DiagnosisService.AddElement(diagnosis);
                }
                else
                {
                    HospitalManager.GetInstance().DiagnosisService.EditElement(_diagnosis.Id, diagnosis);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 10
0
        private void createButton_Click(object sender, EventArgs e)
        {
            try
            {
                Visit visit = new Visit(_doctor.Id, _patient.Id, dateBox.Value.Date, timeBox.Value.TimeOfDay);

                if (_visit is null)
                {
                    HospitalManager.GetInstance().VisitService.AddElement(visit);
                }
                else
                {
                    HospitalManager.GetInstance().VisitService.EditElement(_visit.Id, visit);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 11
0
        private void createButton_Click(object sender, EventArgs e)
        {
            try
            {
                Patient patient = new Patient(nameBox.Text, surnameBox.Text, (Genders)genderBox.SelectedItem, phoneBox.Text, dateBox.Value.Date);

                if (_patient is null)
                {
                    HospitalManager.GetInstance().PatientService.AddElement(patient);
                }
                else
                {
                    HospitalManager.GetInstance().PatientService.EditElement(_patient.Id, patient);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 12
0
        private void createButton_Click(object sender, EventArgs e)
        {
            try
            {
                Disease disease = new Disease(nameBox.Text, descriptionBox.Text);

                if (_disease is null)
                {
                    HospitalManager.GetInstance().DiseaseService.AddElement(disease);
                }
                else
                {
                    HospitalManager.GetInstance().DiseaseService.EditElement(_disease.Id, disease);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 13
0
        public override void ValidateElement(Diagnosis diagnosis)
        {
            logger.Info($"Выполняется валидация данных товара {diagnosis}...");
            if (diagnosis is null)
            {
                throw new ArgumentException("Диагноз не создан");
            }

            if (diagnosis.PatientID <= 0)
            {
                throw new ArgumentException("У диагноза должен быть указан пациент");
            }
            if (diagnosis.DoctorID <= 0)
            {
                throw new ArgumentException("У диагноза должен быть указан врач");
            }
            if (diagnosis.DiseaseID <= 0)
            {
                throw new ArgumentException("У диагноза должно быть указано заболевание");
            }
            if (diagnosis.TreatmentID <= 0)
            {
                throw new ArgumentException("У диагноза должно быть указано лечение");
            }
            if (diagnosis.Date.Date != DateTime.Today)
            {
                throw new ArgumentException("Диагноз не может быть поставлен левым числом");
            }

            Diagnosis diagnosisInBase = HospitalManager.GetInstance().DiagnosisService.GetElement().SingleOrDefault(d => d.Equals(diagnosis));

            if (!(diagnosisInBase is null))
            {
                throw new ArgumentException("Такой диагноз уже есть");
            }
            logger.Info("Валидация завершена");
        }
Ejemplo n.º 14
0
 public Treatment GetTreatment(int id)
 {
     return(HospitalManager.GetInstance().TreatmentService.GetElement().OriginalList.SingleOrDefault(t => t.Id == id));
 }
Ejemplo n.º 15
0
 public Employee GetDoctor(int id)
 {
     return(HospitalManager.GetInstance().EmployeeService.GetElement().OriginalList.SingleOrDefault(e => e.Id == id));
 }
Ejemplo n.º 16
0
 public Patient GetPatient(int id)
 {
     return(HospitalManager.GetInstance().PatientService.GetElement().OriginalList.SingleOrDefault(p => p.Id == id));
 }
Ejemplo n.º 17
0
 public Disease GetDisease(int id)
 {
     return(HospitalManager.GetInstance().DiseaseService.GetElement().OriginalList.SingleOrDefault(d => d.Id == id));
 }