private void OnChuyenKetQuaKham() { if (!_isChuyenBenhAn) { return; } List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgSoCTC.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedRows.Add(row); } } if (dgSoCTC.RowCount <= 0 || deletedRows == null || deletedRows.Count <= 0) { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu ít nhất 1 kết quả soi CTC 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 quả soi CTC 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 quả soi CTC đã chọn đến bệnh nhân: '{0}'?", fileNum)) == DialogResult.No) { return; } Result result = KetQuaSoiCTCBus.ChuyenBenhAn(_patientRow2["PatientGUID"].ToString(), deletedRows); if (result.IsOK) { DisplayAsThread(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.ChuyenBenhAn"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.ChuyenBenhAn")); } }
private void OnDelete() { List <string> deletedKQNSList = new List <string>(); List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgSoCTC.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedKQNSList.Add(row["KetQuaSoiCTCGUID"].ToString()); deletedRows.Add(row); } } if (deletedKQNSList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những kết quả soi mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = KetQuaSoiCTCBus.DeleteKetQuaSoiCTC(deletedKQNSList); if (result.IsOK) { foreach (DataRow row in deletedRows) { dt.Rows.Remove(row); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.DeleteKetQuaSoiCTC"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.DeleteKetQuaSoiCTC")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những kết quả soi.", IconType.Information); } }
private void OnDisplayKetQuaSoiCTCList() { Result result = KetQuaSoiCTCBus.GetKetQuaSoiCTCList(_patientGUID, _fromDate, _toDate); if (result.IsOK) { MethodInvoker method = delegate { ClearData(); DataTable dt = result.QueryResult as DataTable; dgSoCTC.DataSource = dt; if (_isPrint) { DataRow[] rows = dt.Select(string.Format("KetQuaSoiCTCGUID='{0}'", _ketQuaSoiCTC.KetQuaSoiCTCGUID.ToString())); if (rows != null && rows.Length > 0) { OnPrint(rows[0]); } } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList")); } }
private void OnSaveInfo() { try { _ketQuaSoiCTC.PatientGUID = Guid.Parse(_patientGUID); _ketQuaSoiCTC.Status = (byte)Status.Actived; if (_isNew) { _ketQuaSoiCTC.CreatedDate = DateTime.Now; _ketQuaSoiCTC.CreatedBy = Guid.Parse(Global.UserGUID); } else { _ketQuaSoiCTC.UpdatedDate = DateTime.Now; _ketQuaSoiCTC.UpdatedBy = Guid.Parse(Global.UserGUID); } MethodInvoker method = delegate { _ketQuaSoiCTC.NgayKham = dtpkNgayKham.Value; _ketQuaSoiCTC.BacSiSoi = Guid.Parse(cboBSSoi.SelectedValue.ToString()); _ketQuaSoiCTC.KetLuan = cboKetLuan.Text; _ketQuaSoiCTC.DeNghi = cboDeNghi.Text; _ketQuaSoiCTC.Hinh1 = null; _ketQuaSoiCTC.Hinh2 = null; if (picHinh1.Image != null) { _ketQuaSoiCTC.Hinh1 = new System.Data.Linq.Binary(Utility.GetBinaryFromImage(picHinh1.Image)); } if (picHinh2.Image != null) { _ketQuaSoiCTC.Hinh2 = new System.Data.Linq.Binary(Utility.GetBinaryFromImage(picHinh2.Image)); } _ketQuaSoiCTC.AmHo = _uKetQuaSoiCTC.AmHo; _ketQuaSoiCTC.AmDao = _uKetQuaSoiCTC.AmDao; _ketQuaSoiCTC.CTC = _uKetQuaSoiCTC.CTC; _ketQuaSoiCTC.BieuMoLat = _uKetQuaSoiCTC.BieuMoLat; _ketQuaSoiCTC.MoDem = _uKetQuaSoiCTC.MoDem; _ketQuaSoiCTC.RanhGioiLatTru = _uKetQuaSoiCTC.RanhGioiLatTru; _ketQuaSoiCTC.SauAcidAcetic = _uKetQuaSoiCTC.SauAcidAcetic; _ketQuaSoiCTC.SauLugol = _uKetQuaSoiCTC.SauLugol; Result result = KetQuaSoiCTCBus.InsertKetQuaSoiCTC(_ketQuaSoiCTC); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("KetQuaSoiCTCBus.InsertKetQuaSoiCTC"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.InsertKetQuaSoiCTC")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } else { List <Bookmark> bookmarkList = GetBoommark(); if (bookmarkList != null && bookmarkList.Count > 0) { result = BookmarkBus.InsertBookmark(bookmarkList); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("BookmarkBus.InsertBookmark"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("BookmarkBus.InsertBookmark")); 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 bool OnTaoHoSo(DataRow row) { string patientGUID = row["PatientGUID"].ToString(); Result result = ReportBus.GetNgayKhamCuoiCung(patientGUID); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("ReportBus.GetNgayKhamCuoiCung")); return(false); } List <DateTime> ngayKhamCuoiCungList = (List <DateTime>)result.QueryResult; string maBenhNhan = row["FileNum"].ToString(); string tenBenhNhan = Utility.ConvertToUnSign(row["FullName"].ToString()); string path = string.Format("{0}\\{1}@{2}", Global.HoSoPath, maBenhNhan, tenBenhNhan); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string ketQuaKhamTongQuatFileName = string.Format("{0}\\Temp\\KetQuaKhamSucKhoeTongQuat.xls", Application.StartupPath);//string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms")); if (!Exports.ExportExcel.ExportKetQuaKhamTongQuatToExcel(ketQuaKhamTongQuatFileName, row, ngayKhamCuoiCungList)) { return(false); } string pdfFileName = string.Format("{0}\\KetQuaKhamSucKhoeTongQuat_{1}.pdf", path, DateTime.Now.ToString("ddMMyyyyHHmmssms")); if (!Exports.ConvertExcelToPDF.Convert(ketQuaKhamTongQuatFileName, pdfFileName, Utility.GetPageSetup(Const.KhamSucKhoeTongQuatTemplate))) { return(false); } //Kết quả nội soi if (ngayKhamCuoiCungList[5] != Global.MinDateTime) { DateTime fromDate = new DateTime(ngayKhamCuoiCungList[5].Year, ngayKhamCuoiCungList[5].Month, ngayKhamCuoiCungList[5].Day, 0, 0, 0); DateTime toDate = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59); result = KetQuaNoiSoiBus.GetKetQuaNoiSoiList2(patientGUID, fromDate, toDate); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaNoiSoiBus.GetKetQuaNoiSoiList2")); return(false); } DataTable dt = result.QueryResult as DataTable; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { LoaiNoiSoi loaiNoiSoi = (LoaiNoiSoi)Convert.ToInt32(dr["LoaiNoiSoi"]); string ketQuaNoiSoiFileName = string.Format("{0}\\Temp\\KetQuaNoiSoi.xls", Application.StartupPath); //string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms")); PageSetup p = null; switch (loaiNoiSoi) { case LoaiNoiSoi.Tai: if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiToExcel(ketQuaNoiSoiFileName, row, dr)) { return(false); } p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiTemplate); break; case LoaiNoiSoi.Mui: if (!Exports.ExportExcel.ExportKetQuaNoiSoiMuiToExcel(ketQuaNoiSoiFileName, row, dr)) { return(false); } p = Utility.GetPageSetup(Const.KetQuaNoiSoiMuiTemplate); break; case LoaiNoiSoi.Hong_ThanhQuan: if (!Exports.ExportExcel.ExportKetQuaNoiSoiHongThanhQuanToExcel(ketQuaNoiSoiFileName, row, dr)) { return(false); } p = Utility.GetPageSetup(Const.KetQuaNoiSoiHongThanhQuanTemplate); break; case LoaiNoiSoi.TaiMuiHong: if (!Exports.ExportExcel.ExportKetQuaNoiSoiTaiMuiHongToExcel(ketQuaNoiSoiFileName, row, dr)) { return(false); } p = Utility.GetPageSetup(Const.KetQuaNoiSoiTaiMuiHongTemplate); break; case LoaiNoiSoi.TongQuat: if (!Exports.ExportExcel.ExportKetQuaNoiSoiTongQuatToExcel(ketQuaNoiSoiFileName, row, dr)) { return(false); } p = Utility.GetPageSetup(Const.KetQuaNoiSoiTongQuatTemplate); break; } pdfFileName = string.Format("{0}\\KetQuaNoiSoi_{1}_{2}.xls", path, loaiNoiSoi.ToString(), DateTime.Now.ToString("ddMMyyyyHHmmssms")); if (!Exports.ConvertExcelToPDF.Convert(ketQuaNoiSoiFileName, pdfFileName, p)) { return(false); } } } } //Kết quả soi CTC if (ngayKhamCuoiCungList[6] != Global.MinDateTime) { DateTime fromDate = new DateTime(ngayKhamCuoiCungList[6].Year, ngayKhamCuoiCungList[6].Month, ngayKhamCuoiCungList[6].Day, 0, 0, 0); DateTime toDate = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59); result = KetQuaSoiCTCBus.GetKetQuaSoiCTCList2(patientGUID, fromDate, toDate); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("KetQuaSoiCTCBus.GetKetQuaSoiCTCList2")); return(false); } DataTable dt = result.QueryResult as DataTable; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string ketQuaSoiCTCFileName = string.Format("{0}\\Temp\\KetQuaSoiCTC.xls", Application.StartupPath); //string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms")); if (!Exports.ExportExcel.ExportKetQuaSoiCTCToExcel(ketQuaSoiCTCFileName, row, dr)) { return(false); } pdfFileName = string.Format("{0}\\KetQuaSoiCTC_{1}.xls", path, DateTime.Now.ToString("ddMMyyyyHHmmssms")); if (!Exports.ConvertExcelToPDF.Convert(ketQuaSoiCTCFileName, pdfFileName, Utility.GetPageSetup(Const.KetQuaSoiCTCTemplate))) { return(false); } } } } //Kết quả siêu âm if (ngayKhamCuoiCungList[7] != Global.MinDateTime) { DateTime fromDate = new DateTime(ngayKhamCuoiCungList[7].Year, ngayKhamCuoiCungList[7].Month, ngayKhamCuoiCungList[7].Day, 0, 0, 0); DateTime toDate = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day, 23, 59, 59); result = SieuAmBus.GetKetQuaSieuAmList2(patientGUID, fromDate, toDate); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetKetQuaSieuAmList2")); return(false); } DataTable dt = result.QueryResult as DataTable; if (dt != null && dt.Rows.Count > 0) { MethodInvoker method = delegate { foreach (DataRow dr in dt.Rows) { string tenSieuAm = Utility.ConvertToUnSign(dr["TenSieuAm"].ToString()); string ketQuaSieuAmFileName = string.Format("{0}\\KetQuaSieuAm_{1}_{2}.pdf", path, tenSieuAm, DateTime.Now.ToString("ddMMyyyyHHmmssms")); _uPrintKetQuaSieuAm.PatientRow = row; _uPrintKetQuaSieuAm.ExportToPDF(dr, ketQuaSieuAmFileName); } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } } return(true); }