private void OnDisplayKhoCapCuu() { lock (ThisLock) { Result result = KhoCapCuuBus.GetDanhSachCapCuu(_name); if (result.IsOK) { dgThuoc.Invoke(new MethodInvoker(delegate() { ClearData(); DataTable dt = result.QueryResult as DataTable; if (_dtTemp == null) { _dtTemp = dt.Clone(); } UpdateChecked(dt); dgThuoc.DataSource = dt; })); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu")); } } }
private bool CheckInfo() { if (txtTenCapCuu.Text.Trim() == string.Empty) { MsgBox.Show(this.Text, "Vui lòng nhập tên cấp cứu.", IconType.Information); txtTenCapCuu.Focus(); return(false); } string khoCapCuuGUID = _isNew ? string.Empty : _khoCapCuu.KhoCapCuuGUID.ToString(); Result result = KhoCapCuuBus.CheckTenCapCuuExist(khoCapCuuGUID, txtTenCapCuu.Text); if (result.Error.Code == ErrorCode.EXIST || result.Error.Code == ErrorCode.NOT_EXIST) { if (result.Error.Code == ErrorCode.EXIST) { MsgBox.Show(this.Text, "Tên cấp cứu này đã tồn tại rồi. Vui lòng nhập tên khác.", IconType.Information); txtTenCapCuu.Focus(); return(false); } } else { MsgBox.Show(this.Text, result.GetErrorAsString("KhoCapCuuBus.CheckTenCapCuuExist"), IconType.Error); return(false); } return(true); }
private void OnDelete() { if (_dictKhoCapCuu == null) { return; } List <string> deletedThuocList = new List <string>(); List <DataRow> deletedRows = _dictKhoCapCuu.Values.ToList(); foreach (DataRow row in deletedRows) { deletedThuocList.Add(row["KhoCapCuuGUID"].ToString()); } if (deletedThuocList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những thông tin cấp cứu mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = KhoCapCuuBus.DeleteThongTinCapCuu(deletedThuocList); if (result.IsOK) { DataTable dt = dgThuoc.DataSource as DataTable; if (dt == null || dt.Rows.Count <= 0) { return; } foreach (string key in deletedThuocList) { DataRow[] rows = dt.Select(string.Format("KhoCapCuuGUID='{0}'", key)); if (rows == null || rows.Length <= 0) { continue; } dt.Rows.Remove(rows[0]); } _dictKhoCapCuu.Clear(); _dtTemp.Rows.Clear(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KhoCapCuuBus.DeleteThongTinCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.DeleteThongTinCapCuu")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những thông tin cấp cứu cần xóa.", IconType.Information); } }
private void OnDisplayKhoCapCuu() { Result result = KhoCapCuuBus.GetDanhSachCapCuu(); if (result.IsOK) { _dtKhoCapCuu = result.QueryResult as DataTable; } else { MsgBox.Show(this.Text, result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu")); } }
private void OnDisplayCapCuuList() { Cursor.Current = Cursors.WaitCursor; Result result = KhoCapCuuBus.GetDanhSachCapCuu(); if (result.IsOK) { cboCapCuu.DataSource = result.QueryResult; } else { MsgBox.Show(this.Text, result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu")); } }
private void OnDisplayKhoCapCuu() { Result result = KhoCapCuuBus.GetDanhSachCapCuu(); if (result.IsOK) { KhoCapCuuGUID.DataSource = result.QueryResult as DataTable; KhoCapCuuGUID.DisplayMember = "TenCapCuu"; KhoCapCuuGUID.ValueMember = "KhoCapCuuGUID"; } else { MsgBox.Show(this.Text, result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.GetDanhSachCapCuu")); } }
private void OnSaveInfo() { try { _khoCapCuu.TenCapCuu = txtTenCapCuu.Text; _khoCapCuu.Note = txtNote.Text; _khoCapCuu.Status = (byte)Status.Actived; if (_isNew) { _khoCapCuu.CreatedDate = DateTime.Now; _khoCapCuu.CreatedBy = Guid.Parse(Global.UserGUID); } else { _khoCapCuu.UpdatedDate = DateTime.Now; _khoCapCuu.UpdatedBy = Guid.Parse(Global.UserGUID); } MethodInvoker method = delegate { _khoCapCuu.DonViTinh = cboDonViTinh.Text; Result result = KhoCapCuuBus.InsertThongTinCapCuu(_khoCapCuu); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("KhoCapCuuBus.InsertThongTinCapCuu"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KhoCapCuuBus.InsertThongTinCapCuu")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }