public int insertPatient(HospitalInformation.Patient pm)
        {
            MySqlCommand command = new MySqlCommand();

            command.CommandType = CommandType.Text;
            command.CommandText = "insert into hospitalsystem.Patient(LastName,FirstName,userName,psswd,Role,Address,Phone,DOB) values ('" + pm.LastName + "','" + pm.FirstName + "','" + pm.UserName + "','" + pm.Password + "','" + pm.Role + "','" + pm.Address + "','" + pm.Address + "','" + pm.DOB + "')";


            MySqlCommand command2 = new MySqlCommand();

            command2.CommandType = CommandType.Text;
            command2.CommandText = "insert into hospitalsystem.Log(log_event) values('New Patient is added')";
            db.ExeNonQuery(command2);

            return(db.ExeNonQuery(command));
        }
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            Regex regex = new Regex("^[0-9]{10}$");

            if (textLastName.Text != "" & textFirstName.Text != "" & textAddress.Text != "" & textPhone.Text != "" & textUserName.Text != "" & textPassword.Text != "" & regex.IsMatch(textPhone.Text))
            {
                String role = Convert.ToString(comboBoxRole.SelectedItem);
                String dob  = dateTimePicker.Value.ToString();

                pm = new HospitalInformation.Patient(textAddress.Text, textPhone.Text, dob, textFirstName.Text, textLastName.Text, textUserName.Text, textPassword.Text, role);
                int rows = qdal.insertPatient(pm);
                if (rows > 0)
                {
                    MessageBox.Show("Query Executed");
                }
            }

            else
            {
                MessageBox.Show("Fields Cannot be empty or phone number should be only 10 digit numbers");
            }
        }
 public DeletePatient(HospitalInformation.Patient pa)
 {
     InitializeComponent();
     this.pa = pa;
 }