private void OnDisplayKetLuan() { Result result = KetLuanBus.GetKetLuanList(_patientGUID, _fromDate, _toDate); if (result.IsOK) { MethodInvoker method = delegate { ClearData(); dgKetLuan.DataSource = result.QueryResult; }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetLuanBus.GetKetLuanList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetLuanBus.GetKetLuanList")); } }
private void OnSaveInfo() { try { if (_isNew) { _ketLuan.CreatedDate = DateTime.Now; _ketLuan.CreatedBy = Guid.Parse(Global.UserGUID); } else { _ketLuan.UpdatedDate = DateTime.Now; _ketLuan.UpdatedBy = Guid.Parse(Global.UserGUID); } _ketLuan.PatientGUID = Guid.Parse(_patientGUID); MethodInvoker method = delegate { _ketLuan.NgayKetLuan = dtpkNgayKetLuan.Value; _ketLuan.DocStaffGUID = Guid.Parse(cboDocStaff.SelectedValue.ToString()); _ketLuan.HasLamThemXetNghiem = chkCo_1.Checked; _ketLuan.CacXetNghiemLamThem = txtCacXetNghiemLamThem.Text; _ketLuan.HasLamDuCanLamSang = chkCo_2.Checked; _ketLuan.LyDo_CanLamSang = txtLyDo_1.Text; _ketLuan.HasDuSucKhoe = chkCo_3.Checked; _ketLuan.LyDo_SucKhoe = txtLyDo_2.Text; Result result = KetLuanBus.InsertKetLuan(_ketLuan); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("KetLuanBus.InsertKetLuan"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetLuanBus.InsertKetLuan")); 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); } }
private void OnChuyenKetQuaKham() { if (!_isChuyenBenhAn) { return; } List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgKetLuan.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedRows.Add(row); } } if (dgKetLuan.RowCount <= 0 || deletedRows == null || deletedRows.Count <= 0) { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu ít nhất 1 kết luận cần chuyển.", IconType.Information); return; } if (_patientRow2 == null) { MsgBox.Show(Application.ProductName, "Vui lòng chọn bệnh nhân nhận kết luận chuyển đến.", IconType.Information); return; } string fileNum = _patientRow2["FileNum"].ToString(); if (MsgBox.Question(Application.ProductName, string.Format("Bạn có muốn chuyển những kết luận đã chọn đến bệnh nhân: '{0}'?", fileNum)) == DialogResult.No) { return; } Result result = KetLuanBus.ChuyenBenhAn(_patientRow2["PatientGUID"].ToString(), deletedRows); if (result.IsOK) { DisplayAsThread(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetLuanBus.ChuyenBenhAn"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetLuanBus.ChuyenBenhAn")); } }
private void OnDelete() { List <string> deletedKetLuanList = new List <string>(); List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgKetLuan.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedKetLuanList.Add(row["KetLuanGUID"].ToString()); deletedRows.Add(row); } } if (deletedKetLuanList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những kết luận mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = KetLuanBus.DeleteKetLuan(deletedKetLuanList); if (result.IsOK) { foreach (DataRow row in deletedRows) { dt.Rows.Remove(row); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetLuanBus.DeleteKetLuan"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetLuanBus.DeleteKetLuan")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những kết luận cần xóa.", IconType.Information); } }