private void LabOrderTestGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { selectedLabOrderTestDTO = (LabOrderTestDTO)labOrderTestGrid.Rows[e.RowIndex].DataBoundItem; if (labOrderTestGrid.Columns[e.ColumnIndex].Name == "EditLabTest") { using (Form editLabOrderTestDialog = new EditLabOrderTestDialog(selectedLabOrderTestDTO)) { DialogResult result = editLabOrderTestDialog.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Cancel) { this.RefreshDataGrid(); } } } }
/// <summary> /// The event handler method for PatientsDatatGrid CellContentClick /// </summary> private void TestsDatatGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { var test = (LabOrderTestDTO)testsDataGrid.Rows[e.RowIndex].DataBoundItem; if (testsDataGrid.Columns[e.ColumnIndex].Name == "EnterTestResults") { if (String.IsNullOrWhiteSpace(test.TestResult)) { using (Form editTestDialog = new EditLabOrderTestDialog(test)) { DialogResult result = editTestDialog.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Cancel) { visitTests = labOrdersTestController.GetVisitTests(Convert.ToInt32(visit.ID)); this.testsDataGrid.DataSource = visitTests; } } } else { MessageBox.Show("This test has a test result and cannot be edited"); } } }