private void EditData(DataGridViewCellEventArgs e) { try { if (e != null && e.RowIndex >= 0) { sp_RPT001_GetWorkPlaceLight_Result row = gvResult.Rows[e.RowIndex].DataBoundItem as sp_RPT001_GetWorkPlaceLight_Result; using (RPT001_WorkPlaceLightIntensityEntry dlg = new RPT001_WorkPlaceLightIntensityEntry(row.ID)) { if (dlg.ShowDialog(this) == DialogResult.OK) { LoadData(); } } } else if (gvResult.SelectedRows != null && gvResult.SelectedRows.Count > 0) { sp_RPT001_GetWorkPlaceLight_Result row = gvResult.SelectedRows[0].DataBoundItem as sp_RPT001_GetWorkPlaceLight_Result; using (RPT001_WorkPlaceLightIntensityEntry dlg = new RPT001_WorkPlaceLightIntensityEntry(row.ID, true)) { if (dlg.ShowDialog(this) == DialogResult.OK) { LoadData(); } } } } catch (Exception ex) { rMessageBox.ShowException(this, ex); } }
private void AddNew() { try { using (RPT001_WorkPlaceLightIntensityEntry dlg = new RPT001_WorkPlaceLightIntensityEntry()) { if (dlg.ShowDialog(this) == DialogResult.OK) { LoadData(); } } } catch (Exception ex) { rMessageBox.ShowException(this, ex); } }