private void btn_stay_Click(object sender, EventArgs e) { if (grid_patients_dept.SelectedCells.Count > 0) { int selectedrowindex = grid_patients_dept.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = grid_patients_dept.Rows[selectedrowindex]; string patient = Convert.ToString(selectedRow.Cells["ID"].Value); DBhelper.update("update patient set num_of_days_admitted=num_of_days_admitted+1 where p_id='" + patient + "'"); loadPatients(); } }
private void btn_discharge_doc_Click(object sender, EventArgs e) { if (grid_patients_dept.SelectedCells.Count > 0) { int selectedrowindex = grid_patients_dept.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = grid_patients_dept.Rows[selectedrowindex]; string dischargedPatient = Convert.ToString(selectedRow.Cells["ID"].Value); DialogResult dialogResult = MessageBox.Show("Discharge " + dischargedPatient + "?", "Confirm discharge", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { DBhelper.discharge_doc(dischargedPatient, dept); lbl_patient_queue.Text = (int.Parse(lbl_patient_queue.Text) - 1).ToString(); DBhelper.update("update doctor set assigned_patients=assigned_patients-1 where d_id='" + d_id + "'"); loadPatients(); } } }