diff --git a/Medical/MedicalView/Doctors/FormDoctor.Designer.cs b/Medical/MedicalView/Doctors/FormDoctor.Designer.cs index 6154a5c..20077ba 100644 --- a/Medical/MedicalView/Doctors/FormDoctor.Designer.cs +++ b/Medical/MedicalView/Doctors/FormDoctor.Designer.cs @@ -124,6 +124,7 @@ // comboBoxSpecialization // comboBoxSpecialization.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxSpecialization.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSpecialization.FormattingEnabled = true; comboBoxSpecialization.Location = new Point(145, 169); comboBoxSpecialization.Name = "comboBoxSpecialization"; diff --git a/Medical/MedicalView/Doctors/FormDoctor.cs b/Medical/MedicalView/Doctors/FormDoctor.cs index 26b3537..125d09e 100644 --- a/Medical/MedicalView/Doctors/FormDoctor.cs +++ b/Medical/MedicalView/Doctors/FormDoctor.cs @@ -79,6 +79,9 @@ namespace MedicalView.Doctors private void FormDoctor_Load(object sender, EventArgs e) { + var specs = _specializationLogic.ReadList(); + comboBoxSpecialization.DataSource = specs; + if (ModelId.HasValue) { try @@ -91,9 +94,6 @@ namespace MedicalView.Doctors textBoxSurname.Text = view.Surname; textBoxPatronymic.Text = view.Patronymic; textBoxPhoneNumber.Text = view.PhoneNumber; - - var specs = _specializationLogic.ReadList(); - comboBoxSpecialization.DataSource = specs; comboBoxSpecialization.SelectedIndex = specs.FindIndex(x => x.Id == view.SpecializationId); } } diff --git a/Medical/MedicalView/FormMain.cs b/Medical/MedicalView/FormMain.cs index 56bb1cf..096b191 100644 --- a/Medical/MedicalView/FormMain.cs +++ b/Medical/MedicalView/FormMain.cs @@ -103,7 +103,10 @@ namespace MedicalView.Visits var service = Program.ServiceProvider?.GetService(typeof(FormVisit)); if (service is FormVisit form) { - form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } } } diff --git a/Medical/MedicalView/Visits/FormVisit.Designer.cs b/Medical/MedicalView/Visits/FormVisit.Designer.cs index 9ca4811..6931fc1 100644 --- a/Medical/MedicalView/Visits/FormVisit.Designer.cs +++ b/Medical/MedicalView/Visits/FormVisit.Designer.cs @@ -127,6 +127,8 @@ // comboBoxPatient // comboBoxPatient.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxPatient.AutoCompleteMode = AutoCompleteMode.SuggestAppend; + comboBoxPatient.AutoCompleteSource = AutoCompleteSource.ListItems; comboBoxPatient.FormattingEnabled = true; comboBoxPatient.Location = new Point(87, 77); comboBoxPatient.Name = "comboBoxPatient"; @@ -136,6 +138,8 @@ // comboBoxDoctor // comboBoxDoctor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxDoctor.AutoCompleteMode = AutoCompleteMode.SuggestAppend; + comboBoxDoctor.AutoCompleteSource = AutoCompleteSource.ListItems; comboBoxDoctor.FormattingEnabled = true; comboBoxDoctor.Location = new Point(87, 112); comboBoxDoctor.Name = "comboBoxDoctor"; @@ -145,6 +149,8 @@ // comboBoxDiagnose // comboBoxDiagnose.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxDiagnose.AutoCompleteMode = AutoCompleteMode.SuggestAppend; + comboBoxDiagnose.AutoCompleteSource = AutoCompleteSource.ListItems; comboBoxDiagnose.FormattingEnabled = true; comboBoxDiagnose.Location = new Point(87, 150); comboBoxDiagnose.Name = "comboBoxDiagnose"; diff --git a/Medical/MedicalView/Visits/FormVisit.cs b/Medical/MedicalView/Visits/FormVisit.cs index 6f0dce5..ede12fb 100644 --- a/Medical/MedicalView/Visits/FormVisit.cs +++ b/Medical/MedicalView/Visits/FormVisit.cs @@ -77,6 +77,19 @@ namespace MedicalView.Visits private void FormVisit_Load(object sender, EventArgs e) { + var patients = _patientLogic.ReadList(); + var doctors = _doctorLogic.ReadList(); + var diagnoses = _diagnoseLogic.ReadList(); + + comboBoxPatient.DataSource = patients; + comboBoxPatient.SelectedIndex = -1; + + comboBoxDoctor.DataSource = doctors; + comboBoxDoctor.SelectedIndex = -1; + + comboBoxDiagnose.DataSource = diagnoses; + comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Name == "Первичный прием"); + if (ModelId.HasValue) { try @@ -87,13 +100,7 @@ namespace MedicalView.Visits { textBoxComment.Text = view.Comment; datePicker.Value = view.Date.ToDateTime(view.Time); - timePicker.Value = view.Date.ToDateTime(view.Time); - var patients = _patientLogic.ReadList(); - var doctors = _doctorLogic.ReadList(); - var diagnoses = _diagnoseLogic.ReadList(); - comboBoxPatient.DataSource = patients; - comboBoxDoctor.DataSource = doctors; - comboBoxDiagnose.DataSource = diagnoses; + timePicker.Value = view.Date.ToDateTime(view.Time); if (view.DiagnoseId != null) { comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Id == view.DiagnoseId);