private void ActionObject(action vAction) { try { if (grdObject.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) { return; } switch (vAction) { case action.Normal: dtObject = new Select().From(LObjectType.Schema.Name).ExecuteDataSet().Tables[0]; grdObject.DataSource = dtObject; break; case action.Delete: if ( LPatientInfo.CreateQuery().WHERE(LPatientInfo.Columns.ObjectType, Utility.Int32Dbnull(grdObject.GetValue("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 " + grdObject.GetValue("sName"), "Thông báo", true)) { new Delete().From(LObjectType.Schema.Name).Where(LObjectType.Columns.Id).IsEqualTo( Utility.Int32Dbnull(grdObject.GetValue("ID"))).Execute(); grdObject.CurrentRow.Delete(); grdObject.UpdateData(); } dtObject.AcceptChanges(); break; default: var oForm = new frmObjectTypeList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtObject, LObjectType.Columns.Id, grdObject.GetValue("ID")); oForm.dtList = dtObject; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }