protected void Button2_Click(object sender, EventArgs e)
        {
            Label8.Text = "";
            DateTime dt;
            string   dateTime = TextBox5.Text + " " + TextBox6.Text;

            try
            {
                if (string.IsNullOrWhiteSpace(TextBox5.Text) || string.IsNullOrWhiteSpace(TextBox6.Text))
                {
                    throw new Exception("Appointment Date and Appointment Time cannot be empty");
                }
                else if (!DateTime.TryParse(dateTime, out dt))
                {
                    throw new Exception("Appointment date format should be: yyyy/MM/dd and appointment time format should be: HH:mm:ss.");
                }

                ADODatabaseService adodbs = new ADODatabaseService();

                Boolean result = adodbs.AppointmentReschedule(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, Convert.ToDateTime(dateTime));
                if (result == true)
                {
                    Label8.Text = "Updated successfully";
                }
            }
            catch (Exception ex)
            {
                Label8.Text = ex.Message;
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            Label8.Text = "";
            try
            {
                if (string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text))
                {
                    throw new Exception("First name,Last name cannot be empty");
                }
                ADODatabaseService adodbs = new ADODatabaseService();
                string[]           result = adodbs.GetPatientInfo(TextBox2.Text, TextBox3.Text);

                if (result != null)
                {
                    TextBox1.Text = result[0];
                    TextBox4.Text = result[1];
                    TextBox5.Text = result[2];
                    TextBox6.Text = result[3];
                }
                else
                {
                    TextBox1.Text = "";
                    TextBox4.Text = "";
                    TextBox5.Text = "";
                    TextBox6.Text = "";
                    Label8.Text   = "Not found";
                }
            }
            catch (Exception ex)
            {
                Label8.Text = ex.Message;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label8.Text = "";
            try
            {
                int n;
                if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text) || string.IsNullOrWhiteSpace(TextBox5.Text))
                {
                    throw new Exception("Health Insurance NO.,First name,Last name,Phone number,Address cannot be empty");
                }
                else if (!int.TryParse(TextBox4.Text, out n))
                {
                    throw new Exception("Phone number shoule be an integer");
                }

                ADODatabaseService adodbs = new ADODatabaseService();
                Boolean            result = adodbs.PatientRegistration(TextBox1.Text, TextBox2.Text, TextBox3.Text, Convert.ToInt32(TextBox4.Text), TextBox5.Text, TextBox6.Text);
                if (result == true)
                {
                    Label8.Text = "Saved successfully";
                }
                else
                {
                    Label8.Text = "Saved failed";
                }
            }
            catch (Exception ex)
            {
                Label8.Text = ex.Message;
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            Label7.Text = "";
            try
            {
                if (string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text))
                {
                    throw new Exception("First name,Last name cannot be empty");
                }

                ADODatabaseService adodbs = new ADODatabaseService();
                DataSet            result = adodbs.GetDoctorInfo(TextBox2.Text, TextBox3.Text);
                if (result != null)
                {
                    TextBox1.Text = result.Tables[0].Rows[0]["Medical Registration NO."].ToString();
                    DropDownList1.SelectedValue = result.Tables[0].Rows[0]["Health Profession"].ToString();
                    TextBox4.Text = result.Tables[0].Rows[0]["Phone number"].ToString();
                    TextBox5.Text = result.Tables[0].Rows[0]["Email"].ToString();
                }
                else
                {
                    TextBox1.Text = "";
                    DropDownList1.SelectedValue = "";
                    TextBox4.Text = "";
                    TextBox5.Text = "";
                    Label7.Text   = "Not found";
                }
            }
            catch (Exception ex)
            {
                Label7.Text = ex.Message;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label8.Text = "";

            try
            {
                if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text))
                {
                    throw new Exception("Patient's name and Doctor's name cannot be empty");
                }

                ADODatabaseService adodbs = new ADODatabaseService();

                DataSet result = adodbs.GetAppointment(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text);
                if (result != null)
                {
                    string[] dateTime = result.Tables[0].Rows[0]["Appointment date & time"].ToString().Split(' ');
                    TextBox5.Text = dateTime[0];
                    TextBox6.Text = dateTime[1];
                    TextBox7.Text = result.Tables[0].Rows[0]["Clinic name"].ToString();

                    TextBox1.Enabled = false;
                    TextBox2.Enabled = false;
                    TextBox3.Enabled = false;
                    TextBox4.Enabled = false;
                    TextBox7.Enabled = false;
                }
                else
                {
                    Label8.Text = "Not found";
                }
            }
            catch (Exception ex)
            {
                Label8.Text = ex.Message;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime dt;
                string   dateTime = TextBox5.Text + " " + TextBox6.Text + ":00";

                if (string.IsNullOrWhiteSpace(TextBox1.Text) || string.IsNullOrWhiteSpace(TextBox2.Text) || string.IsNullOrWhiteSpace(TextBox3.Text) || string.IsNullOrWhiteSpace(TextBox4.Text) || string.IsNullOrWhiteSpace(TextBox5.Text) ||
                    string.IsNullOrWhiteSpace(TextBox6.Text) || string.IsNullOrWhiteSpace(TextBox7.Text))
                {
                    throw new Exception("Patient's name, Doctor's name, Appointment Date, Appointment Time and Clinic Name cannot be empty");
                }
                else if (!DateTime.TryParse(dateTime, out dt))
                {
                    throw new Exception("Appointment date format should be: yyyy-MM-dd and appointment time format should be: HH:mm.");
                }


                ADODatabaseService adodbs = new ADODatabaseService();


                Boolean result = adodbs.AppointmentBooking(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, Convert.ToDateTime(dateTime), TextBox7.Text);
                if (result == true)
                {
                    Label8.Text = "Saved successfully";
                }
                else
                {
                    Label8.Text = "Saved failed";
                }
            }
            catch (Exception ex)
            {
                Label8.Text = ex.Message;
            }
        }