private void OnDisplayNhanXetKhamLamSangList() { lock (ThisLock) { Result result = NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist(_name); if (result.IsOK) { dgNhanXet.Invoke(new MethodInvoker(delegate() { ClearData(); DataTable dt = result.QueryResult as DataTable; if (_dtTemp == null) { _dtTemp = dt.Clone(); } UpdateChecked(dt); dgNhanXet.DataSource = dt; })); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist")); } } }
private void OnDelete() { if (_dictNhanXet == null) { return; } List <string> deletedList = new List <string>(); List <DataRow> deletedRows = _dictNhanXet.Values.ToList <DataRow>(); foreach (DataRow row in deletedRows) { deletedList.Add(row["NhanXetKhamLamSangGUID"].ToString()); } if (deletedList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những nhận xét khám lâm sàng mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = NhanXetKhamLamSangBus.DeleteNhanXetKhamLamSang(deletedList); if (result.IsOK) { DataTable dt = dgNhanXet.DataSource as DataTable; if (dt == null || dt.Rows.Count <= 0) { return; } foreach (string key in deletedList) { DataRow[] rows = dt.Select(string.Format("NhanXetKhamLamSangGUID='{0}'", key)); if (rows == null || rows.Length <= 0) { continue; } dt.Rows.Remove(rows[0]); } _dictNhanXet.Clear(); _dtTemp.Rows.Clear(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("NhanXetKhamLamSangBus.DeleteNhanXetKhamLamSang"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.DeleteNhanXetKhamLamSang")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những nhận xét khám lâm sàng cần xóa.", IconType.Information); } }
private void InitNhanXet(CoQuan coQuan, ComboBox cboNhanXet) { Result result = NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist((int)coQuan); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.GetNhanXetKhamLamSangist")); return; } else { DataTable dtNhanXet = result.QueryResult as DataTable; DataRow newRow = dtNhanXet.NewRow(); newRow["NhanXetKhamLamSangGUID"] = Guid.Empty; newRow["NhanXet"] = string.Empty; dtNhanXet.Rows.InsertAt(newRow, 0); cboNhanXet.DataSource = dtNhanXet; } }
private void OnSaveInfo() { try { this.Invoke(new MethodInvoker(delegate() { _nhanXetKhamLamSang.Loai = cboCoQuan.SelectedIndex; _nhanXetKhamLamSang.NhanXet = txtNhanXet.Text; })); _nhanXetKhamLamSang.Status = (byte)Status.Actived; if (_isNew) { _nhanXetKhamLamSang.CreatedDate = DateTime.Now; _nhanXetKhamLamSang.CreatedBy = Guid.Parse(Global.UserGUID); } else { _nhanXetKhamLamSang.UpdatedDate = DateTime.Now; _nhanXetKhamLamSang.UpdatedBy = Guid.Parse(Global.UserGUID); } Result result = NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang(_nhanXetKhamLamSang); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }
private bool CheckInfo() { if (cboCoQuan.Text == string.Empty) { MsgBox.Show(this.Text, "Vui lòng chọn cơ quan.", IconType.Information); cboCoQuan.Focus(); return(false); } if (txtNhanXet.Text.Trim() == string.Empty) { MsgBox.Show(this.Text, "Vui lòng nhập nhận xét.", IconType.Information); txtNhanXet.Focus(); return(false); } string nhanXetKhamLamSangGUID = _isNew ? string.Empty : _nhanXetKhamLamSang.NhanXetKhamLamSangGUID.ToString(); Result result = NhanXetKhamLamSangBus.CheckNhanXetExist(nhanXetKhamLamSangGUID, cboCoQuan.SelectedIndex, txtNhanXet.Text); if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST) { if (result.Error.Code == ErrorCode.EXIST) { MsgBox.Show(this.Text, "Nhận xét này đã tồn tại rồi. Vui lòng nhập nhận xét khác.", IconType.Information); txtNhanXet.Focus(); return(false); } } else { MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist")); return(false); } return(true); }
private bool InsertNhanXetKhamLamSang(string nhanXet, int loai) { if (nhanXet.Trim() == string.Empty) { return(true); } Result result = NhanXetKhamLamSangBus.CheckNhanXetExist(null, loai, nhanXet); if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST) { if (result.Error.Code == ErrorCode.NOT_EXIST) { NhanXetKhamLamSang nhanXetKhamLamSang = new NhanXetKhamLamSang(); nhanXetKhamLamSang.Status = (byte)Status.Actived; nhanXetKhamLamSang.CreatedDate = DateTime.Now; nhanXetKhamLamSang.CreatedBy = Guid.Parse(Global.UserGUID); nhanXetKhamLamSang.NhanXet = nhanXet; nhanXetKhamLamSang.Loai = loai; result = NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang(nhanXetKhamLamSang); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.InsertNhanXetKhamLamSang")); return(false); } } } else { MsgBox.Show(this.Text, result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("NhanXetKhamLamSangBus.CheckNhanXetExist")); return(false); } return(true); }