private void btnDoctorRegistrationSearchDoctor_Click(object sender, EventArgs e) { try { string doctorid = txtDoctorRegistrationDoctorID.Text; DoctorDBO ddbo = new DoctorDBO(); Doctor doctor = ddbo.findDoctor(doctorid); txtDoctorRegistrationDoctorID.Text = doctor.getDoctorID(); txtDoctorRegistrationFirstName.Text = doctor.getFirstName(); txtDoctorRegistrationSurname.Text = doctor.getSurname(); txtDoctorRegistrationAddress.Text = doctor.getAddress(); txtDoctorRegistrationDateOfBirth.Text = doctor.getDOB(); txtDoctorRegistrationNIC.Text = doctor.getNIC(); txtDoctorRegistrationContactNo.Text = doctor.getContactNo().ToString(); txtDoctorRegistrationExperience.Text = doctor.getExperience().ToString(); string Speciality = doctor.getSpeciality(); if (Speciality == "Dentist") { rdobtnDoctorRegistrationDentist.Checked = true; } else if (Speciality == "Dental Consultant") { rdobtnDoctorRegistrationConsultant.Checked = true; } } catch (Exception ex) { MessageBox.Show("Couldn't find any records or details of such a Doctor.", "Incorrect Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtScheduleAppointmentDoctorID_TextChanged(object sender, EventArgs e) { try { string doctorid = txtScheduleAppointmentDoctorID.Text; DoctorDBO ddbo = new DoctorDBO(); Doctor doctor = ddbo.findDoctor(doctorid); lblScheduleAppointmentDoctorName.ForeColor = Color.Black; lblScheduleAppointmentDoctorName.Text = "DR. " + doctor.getFirstName() + " " + doctor.getSurname(); } catch { lblScheduleAppointmentDoctorName.ForeColor = Color.Red; lblScheduleAppointmentDoctorName.Text = "Invalid Doctor ID"; } }