public void RemoveDr() { String text = "Do You Want To Remove " + ListSelectedDoctor.Value + " ?"; DialogResult answer = System.Windows.Forms.MessageBox.Show(text, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { DoctorsComboBox.Add(new ComboBoxPairs(ListSelectedDoctor.Key, ListSelectedDoctor.Value)); Hospital.Patients[PatientID].removeDoctor(ListSelectedDoctor.Key); ((Doctor)Hospital.Employees[ListSelectedDoctor.Key]).Patients.Remove(PatientID); HospitalDB.DeleteDoctorPatient(ListSelectedDoctor.Key, PatientID); DoctorsList.Remove(ListSelectedDoctor); DoctorsNumber = "Doctors: " + Hospital.Patients[PatientID].Doctors.Count().ToString(); } }
public void AssignDoctor() { DoctorsList.Add(new ComboBoxPairs(DoctorComboBox.Key, DoctorComboBox.Value)); foreach (Doctor doctor in Hospital.Employees.Values) { if (doctor.ID == DoctorComboBox.Key) { Hospital.Patients[PatientID].Doctors.Add(doctor.ID, doctor); HospitalDB.InsertDoctorPatient(doctor.ID, PatientID); DoctorsNumber = "Doctors: " + Hospital.Patients[PatientID].Doctors.Count().ToString(); break; } } ((Doctor)Hospital.Employees[DoctorComboBox.Key]).Patients.Add(PatientID, Hospital.Patients[PatientID]); DoctorsComboBox.Remove(DoctorComboBox); Home.ViewModel.CloseRootDialog(); }