Example #1
0
        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);
            }
        }
Example #2
0
        private void btnDoctorRegistrationUpdate_Click(object sender, EventArgs e)
        {
            DoctorDBO ddbo       = new DoctorDBO();
            string    doctorid   = txtDoctorRegistrationDoctorID.Text;
            string    fname      = txtDoctorRegistrationFirstName.Text;
            string    surname    = txtDoctorRegistrationSurname.Text;
            string    address    = txtDoctorRegistrationAddress.Text;
            string    dob        = txtDoctorRegistrationDateOfBirth.Text;
            string    nic        = txtDoctorRegistrationNIC.Text;
            int       contactno  = int.Parse(txtDoctorRegistrationContactNo.Text.Trim());
            int       experience = int.Parse(txtDoctorRegistrationExperience.Text.Trim());
            string    speciality = "null"; if (rdobtnDoctorRegistrationDentist.Checked == true)

            {
                speciality = "Dentist";
            }
            else if (rdobtnDoctorRegistrationConsultant.Checked == true)
            {
                speciality = "Dental Consultant";
            }
            ;

            Doctor doctor = new Doctor(doctorid, fname, surname, address, dob, nic, contactno, experience, speciality);

            ddbo.updateDoctorInfo(doctor);
            MessageBox.Show("Changes made to the doctor's information has been updated.", "Edit Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #3
0
        private void btnDoctorRegistrationSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtDoctorRegistrationContactNo.Text))
            {
                MessageBox.Show("The contact number should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtDoctorRegistrationContactNo.TextLength <= 9)
            {
                MessageBox.Show("The contact number should have 10 digits.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (string.IsNullOrWhiteSpace(txtDoctorRegistrationDoctorID.Text))
            {
                MessageBox.Show("A doctor ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    DoctorDBO ddbo       = new DoctorDBO();
                    string    doctorid   = txtDoctorRegistrationDoctorID.Text;
                    string    fname      = txtDoctorRegistrationFirstName.Text;
                    string    surname    = txtDoctorRegistrationSurname.Text;
                    string    address    = txtDoctorRegistrationAddress.Text;
                    string    dob        = txtDoctorRegistrationDateOfBirth.Text;
                    string    nic        = txtDoctorRegistrationNIC.Text;
                    int       contactno  = int.Parse(txtDoctorRegistrationContactNo.Text.Trim());
                    int       experience = int.Parse(txtDoctorRegistrationExperience.Text.Trim());
                    string    speciality = "null"; if (rdobtnDoctorRegistrationDentist.Checked == true)
                    {
                        speciality = "Dentist";
                    }
                    else if (rdobtnDoctorRegistrationConsultant.Checked == true)
                    {
                        speciality = "Dental Consultant";
                    }
                    ;


                    Doctor doctor = new Doctor(doctorid, fname, surname, address, dob, nic, contactno, experience, speciality);
                    ddbo.doctorInfo(doctor);
                    MessageBox.Show("The new doctor's information was added successfully.", "Save Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex2)
                {
                    MessageBox.Show("This Doctor's ID has already been entered.", "Duplicate 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";
     }
 }