private void FillTabe(DoctorServiceRef.Doctor doc, int choose) { string[] columns = new string[] { "ID", "First name", "Last name", "City", "Street", "Phone", "ZIP", "Date of birth" }; for (int i = 0; i < columns.Length; i++) dataGridView1.Columns.Add(i.ToString(), columns[i]); if (choose == 1) { string message = null; DoctorServiceRef.Doctor doctor = new DoctorServiceClient().GetAppointmentsHistoryDoctor(doc.id, ref message); if (doctor != null) { List<DoctorServiceRef.Patient> patientList = new List<DoctorServiceRef.Patient>(); foreach (var appointment in doctor.appointmentsHistory) patientList.Add(appointment.patient); patientList = patientList.GroupBy(p => p.id).Select(g => g.First()).ToList(); for (int i = 0; i < patientList.Count; i++) { dataGridView1.Rows.Add(patientList[i].id, patientList[i].firstName, patientList[i].lastName, patientList[i].city, patientList[i].street + " " + patientList[i].streetNr, patientList[i].phoneNr, patientList[i].zip, patientList[i].dateOfBirth.ToShortDateString()); } } else new Thread(() => new ErrorWindow(message).ShowDialog()).Start(); } else { List<PatientService.Patient> patientList = new PatientServiceClient().GetAllpatients().ToList(); for (int i = 0; i < patientList.Count; i++) { dataGridView1.Rows.Add(patientList[i].id, patientList[i].firstName, patientList[i].lastName, patientList[i].city, patientList[i].street + " " + patientList[i].streetNr, patientList[i].phoneNr, patientList[i].zip, patientList[i].dateOfBirth.ToShortDateString()); } } }
public DoctorMenu(DoctorServiceRef.Doctor doctor) { InitializeComponent(); this.CenterToScreen(); this.doctor = doctor; }
public ListOfPatients(DoctorServiceRef.Doctor doctor, int choose) { InitializeComponent(); this.CenterToScreen(); FillTabe(doctor, choose); }