private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox7.Text != "Select Room")
     {
         comboBox8.Items.Clear();
         comboBox8.Items.Add("Select Bed");
         comboBox8.Text    = "Select Bed";
         comboBox8.Enabled = true;
         PlaceAppointmentmysql roomfee = new PlaceAppointmentmysql();
         textBox15.Text = roomfee.FindRoomFee(int.Parse(comboBox4.Text), int.Parse(comboBox7.Text));
         List <string> beds = roomfee.freeBeds(int.Parse(comboBox4.Text), int.Parse(comboBox7.Text));
         if (beds == null)
         {
             comboBox8.Text    = "No free beds";
             comboBox8.Enabled = false;
         }
         else
         {
             foreach (var item in beds)
             {
                 comboBox8.Items.Add(item);
             }
         }
     }
     else
     {
         comboBox8.Items.Clear();
         comboBox8.Items.Add("Select Bed");
         comboBox8.Text    = "Select Bed";
         comboBox8.Enabled = false;
         textBox15.Text    = null;
     }
 }
 private void button12_Click(object sender, EventArgs e)//appointBTN
 {
     if (checkinput())
     {
         if (checkBox1.Checked)
         {
             try
             {
                 PlaceAppointmentmysql appointPatient = new PlaceAppointmentmysql();
                 appointPatient.AppointPacient(comboBox1.Text, textBox22.Text, comboBox3.Text, int.Parse(comboBox4.Text), int.Parse(comboBox7.Text), comboBox8.Text, dateTimePicker1.Text, textBox17.Text + comboBox6.Text + " - " + textBox18.Text + comboBox5.Text, textBox16.Text);
                 MessageBox.Show($"Successfully added patient - {comboBox1.Text} : {textBox22.Text} to appointment list", "Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 appointPatient.changeBedfree(comboBox8.Text, int.Parse(comboBox4.Text), int.Parse(comboBox7.Text));
                 appointPatient.changepatientPLaced(comboBox1.Text);
                 Clera();
             }
             catch (Exception)
             {
                 MessageBox.Show("Please enter valid details", "Invalid details", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             PlaceAppointmentmysql appointPatient = new PlaceAppointmentmysql();
             appointPatient.AppointPacient(comboBox1.Text, textBox22.Text, comboBox3.Text, 0, 0, null, dateTimePicker1.Text, textBox17.Text + comboBox6.Text + " - " + textBox18.Text + comboBox5.Text, textBox16.Text);
             MessageBox.Show($"Successfully added patient - {comboBox1.Text} : {textBox22.Text} to appointment list", "Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
             appointPatient.changepatientPLaced(comboBox1.Text);
             Clera();
         }
     }
     else
     {
         MessageBox.Show("Please enter valid input", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox4.Text != "Select Floor")
     {
         comboBox7.Items.Clear();
         comboBox7.Items.Add("Select Room");
         comboBox7.Text    = "Select Room";
         comboBox7.Enabled = true;
         PlaceAppointmentmysql findroom = new PlaceAppointmentmysql();
         List <string>         rooms    = findroom.FindRooms(int.Parse(comboBox4.Text));
         foreach (var item in rooms)
         {
             comboBox7.Items.Add(item);
         }
     }
     else
     {
         comboBox7.Items.Clear();
         comboBox7.Items.Add("Select Room");
         comboBox7.Text = "Select Room";
         comboBox8.Items.Clear();
         comboBox8.Items.Add("Select Bed");
         comboBox8.Text    = "Select Bed";
         comboBox7.Enabled = false;
         comboBox8.Enabled = false;
     }
 }
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     textBox22.Clear();
     if (comboBox1.Text != "Patient ID")
     {
         PlaceAppointmentmysql name = new PlaceAppointmentmysql();
         textBox22.Text = name.findpatientsinformation(comboBox1.Text);
     }
 }
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
     textBox20.Clear();
     textBox14.Clear();
     textBox2.Clear();
     if (comboBox3.Text != "Select Doctor")
     {
         PlaceAppointmentmysql doctorinfo = new PlaceAppointmentmysql();
         List <string>         doctor     = doctorinfo.findDoctorInformation(comboBox3.Text);
         try
         {
             textBox20.Text = doctor[0];
             textBox14.Text = doctor[1];
             textBox2.Text  = doctor[2];
         }
         catch (Exception)
         {
             textBox20.Clear();
             textBox14.Clear();
             textBox2.Clear();
         }
     }
 }
 private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     comboBox3.Items.Clear();
     textBox20.Clear();
     textBox14.Clear();
     textBox2.Clear();
     comboBox3.Items.Add("Select Doctor");
     comboBox3.Text = "Select Doctor";
     if (comboBox2.Text != "Doctor Qualification")
     {
         PlaceAppointmentmysql DoctorsNames = new PlaceAppointmentmysql();
         List <string>         names        = DoctorsNames.FindDoctorsNAMEbyqualification(comboBox2.Text);
         foreach (var item in names)
         {
             comboBox3.Items.Add(item.ToString());
             comboBox3.Enabled = true;
         }
     }
     else
     {
         comboBox3.Enabled = false;
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            Clera();
            panel2.Visible          = true;
            dateTimePicker1.MinDate = DateTime.Today;
            PlaceAppointmentmysql doctorsqualifications = new PlaceAppointmentmysql();
            List <string>         qualifications        = doctorsqualifications.FindDoctorsQualifications();
            List <string>         patientsID            = doctorsqualifications.FindAllPatintsID();
            List <string>         floors = doctorsqualifications.FindFloors();//???

            foreach (var item in qualifications)
            {
                comboBox2.Items.Add(item);
            }
            foreach (var item in patientsID)
            {
                comboBox1.Items.Add(item);
            }
            foreach (var item in floors)
            {
                comboBox4.Items.Add(item);
            }
        }