private void VisitDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { try { int id = int.Parse(this.visitDataGridView.Rows[e.RowIndex].Cells["VisitID"].Value.ToString()); Visit oldVisit = this.visitController.GetVisitByID(id); this.ParentForm.Enabled = false; MainDashboardNurse parent = (MainDashboardNurse)this.ParentForm; AddEditVisit addEditVisit = new AddEditVisit(oldVisit, parent.loggedInNurse); DialogResult result = addEditVisit.ShowDialog(); this.ParentForm.Enabled = true; if (result == DialogResult.OK) { this.ResetDataGridView(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } }
private void Appointments_datagridview_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].ToString() == this.appointments_datagridview.Columns["AddEditVisit"].ToString()) { try { int id = int.Parse(this.appointments_datagridview.Rows[e.RowIndex].Cells["AppointmentID"].Value.ToString()); Visit visit = this.VisitController.GetVisitByAppointmentID(id); this.ParentForm.Enabled = false; MainDashboardNurse parent = (MainDashboardNurse)this.ParentForm; AddEditVisit addEditVisit = new AddEditVisit(visit, parent.loggedInNurse); DialogResult result = addEditVisit.ShowDialog(); this.ParentForm.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.GetType().ToString()); } } }
private void patients_datagridview_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex].ToString() == this.patients_datagridview.Columns["AddEditVisit"].ToString()) { try { int id = int.Parse(this.patients_datagridview.Rows[e.RowIndex].Cells["AppointmentID"].Value.ToString()); Visit visit = this.visitController.GetVisitByAppointmentID(id); this.ParentForm.Enabled = false; MainDashboardNurse parent = (MainDashboardNurse)this.ParentForm; AddEditVisit addEditVisit = new AddEditVisit(visit, parent.loggedInNurse); DialogResult result = addEditVisit.ShowDialog(); this.ParentForm.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), ex.GetType().ToString()); } } if (this.dataGridView_Is_Patient) { DataGridViewRow selectedRow = this.patients_datagridview.CurrentRow; this.selectedPatientID = (int)selectedRow.Cells["PatientID"].Value; this.patients_datagridview.DataSource = null; this.SetUpDataGridView_ForSelectedPatientAppointment(); this.GetAppointmentData_ForSelectedPatient(this.selectedPatientID); this.dataGridView_Is_Patient = false; } }