public int insertDoctor(HospitalInformation.Doctor doc) { MySqlCommand command = new MySqlCommand(); command.CommandType = CommandType.Text; command.CommandText = "insert into hospitalsystem.Doctor(LastName, FirstName, userName, psswd, Role, Specialist) values('" + doc.LastName + "', '" + doc.FirstName + "', '" + doc.UserName + "', '" + doc.Password + "', '" + doc.Role + "', '" + doc.Type + "')"; MySqlCommand command2 = new MySqlCommand(); command2.CommandType = CommandType.Text; command2.CommandText = "insert into hospitalsystem.Log(log_event) values('New Doctor is added')"; db.ExeNonQuery(command2); return(db.ExeNonQuery(command)); }
private void buttonCreate_Click(object sender, EventArgs e) { if (textLastName.Text != "" & textFirstName.Text != "" & textUserName.Text != "" & textPassword.Text != "") { String role = Convert.ToString(comboBoxRole.SelectedItem); String spec = Convert.ToString(comboBoxSpecialist.SelectedItem); doc = new HospitalInformation.Doctor(spec, textFirstName.Text, textLastName.Text, textUserName.Text, textPassword.Text, role); int rows = qdal.insertDoctor(doc); if (rows > 0) { MessageBox.Show("Query Executed"); } } else { MessageBox.Show("Fields cannot be empty"); } }
public DeleteDoc(HospitalInformation.Doctor pa) { this.pa = pa; InitializeComponent(); }