Поправил отображение комбобоксов

This commit is contained in:
Никита Потапов 2024-05-16 14:32:01 +04:00
parent 1a6a642626
commit 86565351c1
5 changed files with 28 additions and 11 deletions

View File

@ -124,6 +124,7 @@
// comboBoxSpecialization // comboBoxSpecialization
// //
comboBoxSpecialization.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxSpecialization.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxSpecialization.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSpecialization.FormattingEnabled = true; comboBoxSpecialization.FormattingEnabled = true;
comboBoxSpecialization.Location = new Point(145, 169); comboBoxSpecialization.Location = new Point(145, 169);
comboBoxSpecialization.Name = "comboBoxSpecialization"; comboBoxSpecialization.Name = "comboBoxSpecialization";

View File

@ -79,6 +79,9 @@ namespace MedicalView.Doctors
private void FormDoctor_Load(object sender, EventArgs e) private void FormDoctor_Load(object sender, EventArgs e)
{ {
var specs = _specializationLogic.ReadList();
comboBoxSpecialization.DataSource = specs;
if (ModelId.HasValue) if (ModelId.HasValue)
{ {
try try
@ -91,9 +94,6 @@ namespace MedicalView.Doctors
textBoxSurname.Text = view.Surname; textBoxSurname.Text = view.Surname;
textBoxPatronymic.Text = view.Patronymic; textBoxPatronymic.Text = view.Patronymic;
textBoxPhoneNumber.Text = view.PhoneNumber; textBoxPhoneNumber.Text = view.PhoneNumber;
var specs = _specializationLogic.ReadList();
comboBoxSpecialization.DataSource = specs;
comboBoxSpecialization.SelectedIndex = specs.FindIndex(x => x.Id == view.SpecializationId); comboBoxSpecialization.SelectedIndex = specs.FindIndex(x => x.Id == view.SpecializationId);
} }
} }

View File

@ -103,7 +103,10 @@ namespace MedicalView.Visits
var service = Program.ServiceProvider?.GetService(typeof(FormVisit)); var service = Program.ServiceProvider?.GetService(typeof(FormVisit));
if (service is FormVisit form) if (service is FormVisit form)
{ {
form.ShowDialog(); if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
} }
} }

View File

@ -127,6 +127,8 @@
// comboBoxPatient // comboBoxPatient
// //
comboBoxPatient.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxPatient.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxPatient.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBoxPatient.AutoCompleteSource = AutoCompleteSource.ListItems;
comboBoxPatient.FormattingEnabled = true; comboBoxPatient.FormattingEnabled = true;
comboBoxPatient.Location = new Point(87, 77); comboBoxPatient.Location = new Point(87, 77);
comboBoxPatient.Name = "comboBoxPatient"; comboBoxPatient.Name = "comboBoxPatient";
@ -136,6 +138,8 @@
// comboBoxDoctor // comboBoxDoctor
// //
comboBoxDoctor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxDoctor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxDoctor.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBoxDoctor.AutoCompleteSource = AutoCompleteSource.ListItems;
comboBoxDoctor.FormattingEnabled = true; comboBoxDoctor.FormattingEnabled = true;
comboBoxDoctor.Location = new Point(87, 112); comboBoxDoctor.Location = new Point(87, 112);
comboBoxDoctor.Name = "comboBoxDoctor"; comboBoxDoctor.Name = "comboBoxDoctor";
@ -145,6 +149,8 @@
// comboBoxDiagnose // comboBoxDiagnose
// //
comboBoxDiagnose.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; comboBoxDiagnose.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxDiagnose.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBoxDiagnose.AutoCompleteSource = AutoCompleteSource.ListItems;
comboBoxDiagnose.FormattingEnabled = true; comboBoxDiagnose.FormattingEnabled = true;
comboBoxDiagnose.Location = new Point(87, 150); comboBoxDiagnose.Location = new Point(87, 150);
comboBoxDiagnose.Name = "comboBoxDiagnose"; comboBoxDiagnose.Name = "comboBoxDiagnose";

View File

@ -77,6 +77,19 @@ namespace MedicalView.Visits
private void FormVisit_Load(object sender, EventArgs e) 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) if (ModelId.HasValue)
{ {
try try
@ -87,13 +100,7 @@ namespace MedicalView.Visits
{ {
textBoxComment.Text = view.Comment; textBoxComment.Text = view.Comment;
datePicker.Value = view.Date.ToDateTime(view.Time); datePicker.Value = view.Date.ToDateTime(view.Time);
timePicker.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;
if (view.DiagnoseId != null) if (view.DiagnoseId != null)
{ {
comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Id == view.DiagnoseId); comboBoxDiagnose.SelectedIndex = diagnoses.FindIndex(x => x.Id == view.DiagnoseId);