private void button22_Click(object sender, EventArgs e) { doctorSQL removePR = new doctorSQL(); removePR.removePrescription(label69.Text); string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"select prescription_ID, patinet_id, patient_name, prescription_date from M3dic.prescription where doctor_name = '{this.name}' order by patient_name", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView4.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button19_Click(object sender, EventArgs e) { doctorSQL update_appointment_time = new doctorSQL(); update_appointment_time.UpdateTIME(textBox45.Text, textBox39.Text, textBox38.Text); string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"SELECT patient_id,appointment_data,appointment_time FROM M3dic.patients_appointment where curdate() <= str_to_date(appointment_data, '%d/%m/%Y') and doctor_name = '{this.name}';", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView3.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button13_Click_1(object sender, EventArgs e) { doctorSQL checkforPRID = new doctorSQL(); if (button13.Text == "GENERATE PRESCRIPTION") { try { checkforPRID.generateprescription(label65.Text, textBox17.Text, textBox15.Text + " " + textBox13.Text, this.special_id, this.name, label66.Text); checkforPRID.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Prescription generated successfully", "Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { MessageBox.Show("Please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"select patient_id as 'Special ID', patient_name as 'Name', dignose from M3dic.patients_appointment where doctor_name = '{this.name}' ", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView2.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { checkforPRID.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Prescription updated successfully", "Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"select patient_id as 'Special ID', patient_name as 'Name', dignose from M3dic.patients_appointment where doctor_name = '{this.name}' ", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView2.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button1_Click_1(object sender, EventArgs e)//deleting users { if (label52.Text == "" || label53.Text == "") { MessageBox.Show("Please select staff different from Admin", "Error selection", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } doctorSQL removestaff = new doctorSQL(); removestaff.removeDoctor(label52.Text, label53.Text); }
private void button13_Click(object sender, EventArgs e) { try { doctorSQL updatediagnose = new doctorSQL(); updatediagnose.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Successfully updated diagnose user: "******" - diagnose updated", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } catch (Exception) { MessageBox.Show("Please contact admin", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { dataGridView2.CurrentRow.Selected = true; textBox17.Text = dataGridView2.Rows[e.RowIndex].Cells["Special ID"].FormattedValue.ToString(); textBox20.Text = dataGridView2.Rows[e.RowIndex].Cells["dignose"].FormattedValue.ToString(); } label27.Text = textBox17.Text + " - Diagnose"; Register_LoginMYSQL infopatient = new Register_LoginMYSQL(); List <string> infopatients = infopatient.patientINFO(textBox17.Text); textBox15.Text = infopatients[0]; textBox13.Text = infopatients[1]; textBox11.Text = infopatients[2]; textBox16.Text = infopatients[3]; textBox14.Text = infopatients[4]; textBox12.Text = infopatients[5]; textBox10.Text = infopatients[6]; doctorSQL checkforPRID = new doctorSQL(); List <string> ID = checkforPRID.checkPRID(textBox17.Text); if (ID.Count == 0)//no such prescription { label65.Text = checkforPRID.lastprid(); label66.Text = DateTime.Today.ToString(); button13.Text = "GENERATE PRESCRIPTION"; } else { label65.Text = ID[0]; label66.Text = ID[1]; button13.Text = "UPDATE"; } } catch (Exception) { } }