private void viewRecordsToolStripMenuItem1_Click(object sender, EventArgs e) { patientsrecords f2 = new patientsrecords(); f2.PatientID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); f2.textBox9.Text = this.dataGridView1.CurrentRow.Cells[8].Value.ToString(); f2.ShowDialog(); }
private void button23_Click(object sender, EventArgs e) { try { MySqlConnection conn2 = new MySqlConnection("datasource=localhost;port=3306;username=root"); conn2.Open(); MySqlCommand comm2 = new MySqlCommand("select * from databaseitu.tblquelist where status='Ongoing' and PatientFK='" + textBox24.Text + "'", conn2); comm2.ExecuteNonQuery(); MySqlDataReader dr2 = comm2.ExecuteReader(); MySqlConnection conn3 = new MySqlConnection("datasource=localhost;port=3306;username=root"); conn3.Open(); MySqlCommand comm3 = new MySqlCommand("select * from databaseitu.tblquelist where status='Hold' and PatientFK='" + textBox24.Text + "'", conn3); comm3.ExecuteNonQuery(); MySqlDataReader dr3 = comm3.ExecuteReader(); if (dr2.Read()) { MessageBox.Show("Patient Is In Ongoing status", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (dr3.Read()) { MessageBox.Show("This patient is on Hold status please refresh your database", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MySqlConnection conn = new MySqlConnection("datasource=localhost;port=3306;username=root"); conn.Open(); MySqlCommand comm = new MySqlCommand("Update databaseitu.tblquelist set status= 'Ongoing' where PatientFK='" + textBox24.Text + "'", conn); comm.ExecuteNonQuery(); MySqlDataReader dr = comm.ExecuteReader(); proceedname = textBox13.Text; proceeddrname = textBox16.Text; patientsrecords f3 = new patientsrecords(); f3.PatientID.Text = this.dataGridView2.CurrentRow.Cells[0].Value.ToString(); f3.textBox9.Text = this.dataGridView2.CurrentRow.Cells[6].Value.ToString(); f3.ShowDialog(); } } catch (Exception) { MessageBox.Show("No patient Selected", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }