Пример #1
0
        public EditForm(bool newPatient = true)
        {
            _patientsService      = Program.ServiceProvider.GetService <IPatientsService>();
            _diaryRecordsService  = Program.ServiceProvider.GetService <IDiaryRecordsService>();
            _paymentsService      = Program.ServiceProvider.GetService <IPaymentsService>();
            _dentalRecordsService = Program.ServiceProvider.GetService <IDentalRecordsService>();
            _patientTeethService  = Program.ServiceProvider.GetService <IPatientTeethService>();

            _patientPicturesManager = new PatientPicturesManager();

            InitializeComponent();

            storageComboBox.Items.AddRange(_storages);

            if (newPatient)
            {
                _payments      = new List <Payment>();
                _dentalRecords = new List <DentalRecord>();
                _diary         = new List <DiaryRecord>();
                _patientTeeth  = _patientTeethService.CreateNewPatientTeethAsync().Result;

                #region Set buttons tooltips

                string healthyToothStatusDescription = ToothStatus.Healthy.GetDescription();

                toothStatusToolTip.SetToolTip(button_11, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_12, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_13, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_14, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_15, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_16, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_17, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_18, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_21, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_22, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_23, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_24, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_25, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_26, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_27, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_28, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_31, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_32, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_33, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_34, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_35, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_36, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_37, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_38, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_41, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_42, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_43, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_44, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_45, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_46, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_47, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_48, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_51, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_52, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_53, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_54, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_55, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_61, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_62, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_63, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_64, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_65, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_71, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_72, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_73, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_74, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_75, healthyToothStatusDescription);

                toothStatusToolTip.SetToolTip(button_81, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_82, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_83, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_84, healthyToothStatusDescription);
                toothStatusToolTip.SetToolTip(button_85, healthyToothStatusDescription);

                #endregion Set buttons tooltips

                storageComboBox.SelectedIndex = 0;
                totalImgCountLabel.Text       = $"Всего снимков: {_patientPicturesManager.DisplayedPatientPicturesCount}";
                dateOfBirthPicker.Value       = dateOfBirthPicker.MinDate;

                RefreshDisplayedPatientPicture();
                RefreshAge();
            }
        }
Пример #2
0
        public EditForm(Guid patientID)
            : this(newPatient : false)
        {
            _patientID = patientID;
            var patient = _patientsService.GetPatientAsync(patientID).Result;

            _patientPicturesManager = new PatientPicturesManager(patientID);
            totalImgCountLabel.Text = $"Всего снимков: {_patientPicturesManager.DisplayedPatientPicturesCount}";
            RefreshDisplayedPatientPicture();

            nameTextBox.Text          = patient.Name;
            surnameTextBox.Text       = patient.Surname;
            secnameTextBox.Text       = patient.SecondName;
            lastVisitDatePicker.Value = patient.LastVisitDate;
            dateOfBirthPicker.Value   = patient.BirthDate;
            addressTextBox.Text       = patient.Address;
            diagnosisTextBox.Text     = patient.Diagnosis;
            descriptionTextBox.Text   = patient.Description;

            phoneNumberTextBox.Text = String.IsNullOrEmpty(patient.PhoneNumber?.Trim())
        ? phoneNumberTextBox.Text
        : patient.PhoneNumber;

            switch (patient.Gender)
            {
            case Gender.Male:
                maleRadioButton.Checked = true;
                break;

            case Gender.Female:
                femaleRadioButton.Checked = true;
                break;
            }

            storageComboBox.SelectedIndex = (int)patient.Storage;

            _patientTeeth  = patient.Teeth.OrderBy(tooth => tooth.ToothNumber).ToList();
            _dentalRecords = _dentalRecordsService.GetPatientDentalRecordsAsync(patient.ID).Result;
            _payments      = patient.Payments.ToList();
            _diary         = patient.Diary.ToList();

            if (_patientTeeth.Count == 0)
            {
                _patientTeeth = _patientTeethService.CreateNewPatientTeethAsync(patient).Result;
                _patientTeethService.AddPatientTeethAsync(_patientTeeth);
            }

            #region Set buttons colors

            button_11.BackColor = _patientTeeth[0].Status.ConvertToColor();
            button_12.BackColor = _patientTeeth[1].Status.ConvertToColor();
            button_13.BackColor = _patientTeeth[2].Status.ConvertToColor();
            button_14.BackColor = _patientTeeth[3].Status.ConvertToColor();
            button_15.BackColor = _patientTeeth[4].Status.ConvertToColor();
            button_16.BackColor = _patientTeeth[5].Status.ConvertToColor();
            button_17.BackColor = _patientTeeth[6].Status.ConvertToColor();
            button_18.BackColor = _patientTeeth[7].Status.ConvertToColor();

            button_21.BackColor = _patientTeeth[8].Status.ConvertToColor();
            button_22.BackColor = _patientTeeth[9].Status.ConvertToColor();
            button_23.BackColor = _patientTeeth[10].Status.ConvertToColor();
            button_24.BackColor = _patientTeeth[11].Status.ConvertToColor();
            button_25.BackColor = _patientTeeth[12].Status.ConvertToColor();
            button_26.BackColor = _patientTeeth[13].Status.ConvertToColor();
            button_27.BackColor = _patientTeeth[14].Status.ConvertToColor();
            button_28.BackColor = _patientTeeth[15].Status.ConvertToColor();

            button_31.BackColor = _patientTeeth[16].Status.ConvertToColor();
            button_32.BackColor = _patientTeeth[17].Status.ConvertToColor();
            button_33.BackColor = _patientTeeth[18].Status.ConvertToColor();
            button_34.BackColor = _patientTeeth[19].Status.ConvertToColor();
            button_35.BackColor = _patientTeeth[20].Status.ConvertToColor();
            button_36.BackColor = _patientTeeth[21].Status.ConvertToColor();
            button_37.BackColor = _patientTeeth[22].Status.ConvertToColor();
            button_38.BackColor = _patientTeeth[23].Status.ConvertToColor();

            button_41.BackColor = _patientTeeth[24].Status.ConvertToColor();
            button_42.BackColor = _patientTeeth[25].Status.ConvertToColor();
            button_43.BackColor = _patientTeeth[26].Status.ConvertToColor();
            button_44.BackColor = _patientTeeth[27].Status.ConvertToColor();
            button_45.BackColor = _patientTeeth[28].Status.ConvertToColor();
            button_46.BackColor = _patientTeeth[29].Status.ConvertToColor();
            button_47.BackColor = _patientTeeth[30].Status.ConvertToColor();
            button_48.BackColor = _patientTeeth[31].Status.ConvertToColor();

            button_51.BackColor = _patientTeeth[32].Status.ConvertToColor();
            button_52.BackColor = _patientTeeth[33].Status.ConvertToColor();
            button_53.BackColor = _patientTeeth[34].Status.ConvertToColor();
            button_54.BackColor = _patientTeeth[35].Status.ConvertToColor();
            button_55.BackColor = _patientTeeth[36].Status.ConvertToColor();

            button_61.BackColor = _patientTeeth[37].Status.ConvertToColor();
            button_62.BackColor = _patientTeeth[38].Status.ConvertToColor();
            button_63.BackColor = _patientTeeth[39].Status.ConvertToColor();
            button_64.BackColor = _patientTeeth[40].Status.ConvertToColor();
            button_65.BackColor = _patientTeeth[41].Status.ConvertToColor();

            button_71.BackColor = _patientTeeth[42].Status.ConvertToColor();
            button_72.BackColor = _patientTeeth[43].Status.ConvertToColor();
            button_73.BackColor = _patientTeeth[44].Status.ConvertToColor();
            button_74.BackColor = _patientTeeth[45].Status.ConvertToColor();
            button_75.BackColor = _patientTeeth[46].Status.ConvertToColor();

            button_81.BackColor = _patientTeeth[47].Status.ConvertToColor();
            button_82.BackColor = _patientTeeth[48].Status.ConvertToColor();
            button_83.BackColor = _patientTeeth[49].Status.ConvertToColor();
            button_84.BackColor = _patientTeeth[50].Status.ConvertToColor();
            button_85.BackColor = _patientTeeth[51].Status.ConvertToColor();

            #endregion Set buttons colors

            #region Set buttons tooltips

            toothStatusToolTip.SetToolTip(button_11, _patientTeeth[0].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_12, _patientTeeth[1].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_13, _patientTeeth[2].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_14, _patientTeeth[3].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_15, _patientTeeth[4].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_16, _patientTeeth[5].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_17, _patientTeeth[6].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_18, _patientTeeth[7].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_21, _patientTeeth[8].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_22, _patientTeeth[9].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_23, _patientTeeth[10].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_24, _patientTeeth[11].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_25, _patientTeeth[12].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_26, _patientTeeth[13].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_27, _patientTeeth[14].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_28, _patientTeeth[15].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_31, _patientTeeth[16].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_32, _patientTeeth[17].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_33, _patientTeeth[18].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_34, _patientTeeth[19].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_35, _patientTeeth[20].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_36, _patientTeeth[21].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_37, _patientTeeth[22].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_38, _patientTeeth[23].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_41, _patientTeeth[24].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_42, _patientTeeth[25].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_43, _patientTeeth[26].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_44, _patientTeeth[27].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_45, _patientTeeth[28].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_46, _patientTeeth[29].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_47, _patientTeeth[30].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_48, _patientTeeth[31].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_51, _patientTeeth[32].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_52, _patientTeeth[33].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_53, _patientTeeth[34].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_54, _patientTeeth[35].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_55, _patientTeeth[36].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_61, _patientTeeth[37].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_62, _patientTeeth[38].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_63, _patientTeeth[39].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_64, _patientTeeth[40].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_65, _patientTeeth[41].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_71, _patientTeeth[42].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_72, _patientTeeth[43].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_73, _patientTeeth[44].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_74, _patientTeeth[45].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_75, _patientTeeth[46].Status.GetDescription());

            toothStatusToolTip.SetToolTip(button_81, _patientTeeth[47].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_82, _patientTeeth[48].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_83, _patientTeeth[49].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_84, _patientTeeth[50].Status.GetDescription());
            toothStatusToolTip.SetToolTip(button_85, _patientTeeth[51].Status.GetDescription());

            #endregion Set buttons tooltips

            RefreshPayments();
            RefreshAge();
            RefreshDiary();
        }