public FrmInsuranceAgency(Model.InsuranceAgency editInsuranceAgency) { InitializeComponent(); insuranceAgency = editInsuranceAgency; selectedAddress = editInsuranceAgency.Address; tbNote.Text = editInsuranceAgency.Note; InitializeAddresses(); }
private void BtnAddInsurance_Click(object sender, EventArgs e) { using (var formInsurance = new FrmInsuranceAgency()) { var result = formInsurance.ShowDialog(); if (result == DialogResult.OK) { var insuranceAgency = formInsurance.insuranceAgency; InitializeInsuranceAgencies(); selectedInsurance = insuranceAgency; cbInsurance.SelectedIndex = insuranceAgencies.Select(o => o.Id).ToList().IndexOf(selectedInsurance.Id); } } }
public FrmPatient(Model.Patient editPatient) { InitializeComponent(); InitializeAdditionalComponents(); patient = editPatient; selectedAddress = editPatient.Address; selectedInsurance = editPatient.InsuranceAgency; selectedDoctor = editPatient.LocalDoctor; tbGender.Text = editPatient.Gender; dtpBirthday.Value = editPatient.Birthday; tbInsuranceNr.Text = Convert.ToString(editPatient.InsuranceNr); tbNote.Text = editPatient.Note; InitializeAddresses(); cbInsurance.SelectedIndex = insuranceAgencies.Select(o => o.Id).ToList().IndexOf(selectedInsurance.Id); cbDoctor.SelectedIndex = doctors.Select(o => o.Id).ToList().IndexOf(selectedDoctor.Id); InitializeAddresses(); }
private void BtnSave_Click(object sender, EventArgs e) { if (selectedAddress == null) { MessageBox.Show("Die Krankenkasse kann nicht gespeichert werden ohne gültige Adressdaten."); } else { if (insuranceAgency != null) // edit handover insuranceAgency { insuranceAgency.Address = selectedAddress; insuranceAgency.Note = tbNote.Text; insuranceAgency.Update(); } else { insuranceAgency = new Model.InsuranceAgency(selectedAddress, tbNote.Text); // create new insuranceAgency } this.DialogResult = DialogResult.OK; } }
private void BtnEditInsurance_Click(object sender, EventArgs e) { if (selectedInsurance == null) { MessageBox.Show("Um eine bestehende Krankenkasse zu bearbeiten, muss zunächst eine Krankenkasse ausgewählt werden."); } else { using (var formInsurance = new FrmInsuranceAgency(selectedInsurance)) { var result = formInsurance.ShowDialog(); if (result == DialogResult.OK) { var insuranceAgency = formInsurance.insuranceAgency; InitializeInsuranceAgencies(); selectedInsurance = insuranceAgency; cbInsurance.SelectedIndex = insuranceAgencies.Select(o => o.Id).ToList().IndexOf(selectedInsurance.Id); } } } }
private void CbInsurance_SelectedIndexChanged(object sender, EventArgs e) { selectedInsurance = insuranceAgencies[cbInsurance.SelectedIndex]; }