private void LoadFormTestTypeAU(action vAction) { try { if (grdTestType.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) { return; } switch (vAction) { case action.Normal: dtTestType = new Select().From(TTestTypeList.Schema.Name).OrderAsc(TTestTypeList.Columns.IntOrder). ExecuteDataSet().Tables[0]; grdTestType.DataSource = dtTestType; break; case action.Delete: if ( DDeviceList.CreateQuery().WHERE(DDeviceList.Columns.TestTypeId, Utility.Int32Dbnull(grdTestType.GetValue("TestType_ID"))). GetRecordCount() > 0) { Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa"); return; } if (Utility.AcceptQuestion("Thực hiện xóa " + grdTestType.GetValue("TestType_Name"), "Thông báo", true)) { new Delete().From(TTestTypeList.Schema.Name).Where(TTestTypeList.Columns.TestTypeId). IsEqualTo( Utility.Int32Dbnull(grdTestType.GetValue("TestType_ID"))).Execute(); grdTestType.CurrentRow.Delete(); grdTestType.UpdateData(); } break; default: var oForm = new frmTestTypeList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtTestType, TTestTypeList.Columns.TestTypeId, grdTestType.GetValue("TestType_ID")); oForm.dtList = dtTestType; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void LoadFormTestTypeAU(action vAction) { try { if (grdTestType.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return; switch (vAction) { case action.Normal: dtTestType = new Select().From(TTestTypeList.Schema.Name).OrderAsc(TTestTypeList.Columns.IntOrder). ExecuteDataSet().Tables[0]; grdTestType.DataSource = dtTestType; break; case action.Delete: if ( DDeviceList.CreateQuery().WHERE(DDeviceList.Columns.TestTypeId, Utility.Int32Dbnull(grdTestType.GetValue("TestType_ID"))). GetRecordCount() > 0) { Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa"); return; } if (Utility.AcceptQuestion("Thực hiện xóa " + grdTestType.GetValue("TestType_Name"), "Thông báo", true)) { new Delete().From(TTestTypeList.Schema.Name).Where(TTestTypeList.Columns.TestTypeId). IsEqualTo( Utility.Int32Dbnull(grdTestType.GetValue("TestType_ID"))).Execute(); grdTestType.CurrentRow.Delete(); grdTestType.UpdateData(); } break; default: var oForm = new frmTestTypeList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtTestType, TTestTypeList.Columns.TestTypeId, grdTestType.GetValue("TestType_ID")); oForm.dtList = dtTestType; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }