public void SetUp() { patient1 = new Patient("John Doe1", "Podiatristcomplaint3"); patient2 = new Patient("John Doe2", "Dentistcomplaint2"); patient3 = new Patient("John Doe3", "ENTcomplaint1"); patient4 = new Patient("John Doe4", "Pain simulation"); dentist = new Dentist("Brian Smith"); ent = new ENT("Colin Johnson"); podiatrist = new Podiatrist("Dominic Taylor"); List<BaseDoctor> doctors = new List<BaseDoctor> { dentist, ent, podiatrist }; hospital = new Hospital(); hospital.AddRangeDoctors(doctors); insuranceCompany = new InsuranceCompany(); List<Person> clients = new List<Person> { patient1, patient2, patient3, patient4 }; insuranceCompany.AddRangeClients(clients); }
private void modifyData() { dataFromGrid.Clear(); try { if (doctor == false) { int curRowIndex = dataGridView1.CurrentCell.RowIndex; string tmpID = null; Patient patientSearchCriteria = new Patient(); Address addressSearchCriteria = new Address(); if (dataGridView1.Rows[curRowIndex].Cells[0].Value == null) { throw new Exception(); } tmpID = dataGridView1.Rows[curRowIndex].Cells[0].Value.ToString(); int id = Int32.Parse(tmpID); patientSearchCriteria.id_patient = id; addressSearchCriteria.id_patient = id; Patient patient = RegistrationFacade.GetPatientByID(patientSearchCriteria); Address address = RegistrationFacade.GetAdressByID(addressSearchCriteria); if (patient == null) { throw new Exception(); } dataFromGrid.Add(tmpID); dataFromGrid.Add(patient.fname.ToString()); dataFromGrid.Add(patient.lname.ToString()); dataFromGrid.Add(patient.PESEL.ToString()); if (address != null) { dataFromGrid.Add(address.place.ToString()); dataFromGrid.Add(address.street.ToString()); dataFromGrid.Add(address.zip_code.ToString()); dataFromGrid.Add(address.house.ToString()); dataFromGrid.Add(address.flat.ToString()); } } else { int curRowIndex = dataGridView1.CurrentCell.RowIndex; string tmpID = null; DataLayer.Doctor doctorSearchCriteria = new DataLayer.Doctor(); if (dataGridView1.Rows[curRowIndex].Cells[0].Value == null) { throw new Exception(); } tmpID = dataGridView1.Rows[curRowIndex].Cells[0].Value.ToString(); int id = Int32.Parse(tmpID); dataFromGrid.Add(tmpID); dataFromGrid.Add(dataGridView1.Rows[curRowIndex].Cells[1].Value.ToString()); dataFromGrid.Add(dataGridView1.Rows[curRowIndex].Cells[2].Value.ToString()); } } catch { //MessageBox.Show("No data !", "ERROR!"); MessageBox.Show("No data !", "ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Close(); }
public void Reception(Patient patient) { currentPatient = patient; ChooseDoctor(); if (currentDoctorType != Doctor.Unknown) { SendToTheDoctor(); } else { ResetCurrentData(); } }