private void bttn_newPatient_Click(object sender, EventArgs e) { using (var formPatient = new View.FrmPatient()) { var result = formPatient.ShowDialog(); if (result == DialogResult.OK) { var patient = formPatient.patient; InitializePatients(); selectedPatient = patient; lbPatients.SelectedIndex = activePatients.Select(o => o.Id).ToList().IndexOf(selectedPatient.Id); } } }
private void bttn_editPatient_Click(object sender, EventArgs e) { if (selectedPatient != null) { using (var formPatient = new View.FrmPatient(selectedPatient)) { var result = formPatient.ShowDialog(); if (result == DialogResult.OK) { var patient = formPatient.patient; InitializePatients(); selectedPatient = patient; lbPatients.SelectedIndex = activePatients.Select(o => o.Id).ToList().IndexOf(selectedPatient.Id); } } } else { MessageBox.Show("Um die Patientendaten eines bestehenden Patienten zu bearbeiten, müssen sie zunächst einen Patienten auswählen."); } }