private void ActionDoctor(action vAction) { try { if (grdDoctor.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) { return; } switch (vAction) { case action.Normal: dtDoctor = new Select().From(LUser.Schema.Name).ExecuteDataSet().Tables[0]; grdDoctor.DataSource = dtDoctor; break; case action.Delete: if (TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.DiagnosticianId, Utility.Int32Dbnull(grdDoctor.GetValue("User_ID"))). OR(TTestInfo.Columns.AssignId, Utility.Int32Dbnull(grdDoctor.GetValue("User_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 " + grdDoctor.GetValue("User_Name"), "Thông báo", true)) { new Delete().From(LUser.Schema.Name).Where(LUser.Columns.UserId). IsEqualTo(Utility.Int32Dbnull(grdDoctor.GetValue("User_ID"))). Execute(); grdDoctor.CurrentRow.Delete(); grdDoctor.UpdateData(); dtDoctor.AcceptChanges(); } break; default: var oForm = new frmDoctorList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtDoctor, LUser.Columns.UserId, grdDoctor.GetValue("User_ID")); oForm.dtList = dtDoctor; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void ActionDoctor(action vAction) { try { if (grdDoctor.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return; switch (vAction) { case action.Normal: dtDoctor = new Select().From(LUser.Schema.Name).ExecuteDataSet().Tables[0]; grdDoctor.DataSource = dtDoctor; break; case action.Delete: if (TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.DiagnosticianId,Utility.Int32Dbnull(grdDoctor.GetValue("User_ID"))). OR(TTestInfo.Columns.AssignId,Utility.Int32Dbnull(grdDoctor.GetValue("User_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 " + grdDoctor.GetValue("User_Name"), "Thông báo", true)) { new Delete().From(LUser.Schema.Name).Where(LUser.Columns.UserId). IsEqualTo(Utility.Int32Dbnull(grdDoctor.GetValue("User_ID"))). Execute(); grdDoctor.CurrentRow.Delete(); grdDoctor.UpdateData(); dtDoctor.AcceptChanges(); } break; default: var oForm = new frmDoctorList_AU(); oForm.vAction = vAction; oForm.drList = Utility.GetDataRow(dtDoctor, LUser.Columns.UserId,grdDoctor.GetValue("User_ID")); oForm.dtList = dtDoctor; oForm.ShowDialog(); break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }