/// <summary> /// Lấy id của các loại xét nghiệm /// </summary> /// <param name="dt"></param> /// <param name="grd"></param> /// <param name="colName"></param> /// <param name="errResult"></param> /// <returns></returns> private string GetIdString(DataTable dt, GridEX grd, string colName, string errResult) { try { string vResult = errResult; int count = 0; foreach (GridEXRow grdRow in grd.GetCheckedRows()) { if (grdRow.IsChecked) { vResult += "," + grdRow.Cells[colName].Value; count += 1; } } if (count == PreloadedLists.TestType.Rows.Count) { vResult = errResult; } return(vResult); } catch (Exception ex) { Utility.ShowMsg(ex.Message); return("-1"); } }
string getCheckedvalue(GridEX grd, string fieldName) { string reval = ""; try { foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grd.GetCheckedRows()) { reval += Utility.sDbnull(gridExRow.Cells[fieldName].Value, "") + ","; } if (reval != "") { reval = reval.Substring(0, reval.Length - 1); } return(reval); } catch (Exception) { return(""); } }
private string GetIdString(DataTable dt, GridEX grd, string colName, string errResult) { try { string vResult = errResult; int count = 0; foreach (GridEXRow grdRow in grd.GetCheckedRows()) { if (grdRow.IsChecked) { vResult += "," + grdRow.Cells[colName].Value; count += 1; } } if (count == PreloadedLists.TestType.Rows.Count) vResult = errResult; return vResult; } catch (Exception ex) { Utility.ShowMsg(ex.Message); return "-1"; } }
private void INPHIEU_XETNGHIEM(bool IsQuick, string sTitleReport, DateTime NgayIn) { string strPatient_ID = string.Empty; var DTPrint = new DataTable(); string vTestTypeId = GetCheckTestType(); string vTestID = GetcheckTestID(); if (vTestTypeId == "-1") { Utility.ShowMsg("Chưa chọn loại xét nghiệm để in"); return; } if (grdList.GetCheckedRows().Length > 0) { foreach (GridEXRow gridExRow in grdList.GetCheckedRows()) { strPatient_ID += "," + Utility.Int32Dbnull(gridExRow.Cells["Patient_ID"].Value, -1); } strPatient_ID = strPatient_ID.Remove(0, 1); } else { strPatient_ID = Utility.sDbnull(grdList.GetValue("Patient_ID")); } DTPrint = SPs.GtvtGetTestResultForPrintV2FromDateToDate(strPatient_ID, vTestTypeId, vTestID, dtFromDate.Date.ToShortDateString(), dtToDate.Date.ToShortDateString()).GetDataSet().Tables[0]; if (DTPrint.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy bản ghi nào", "Thông báo"); return; } ProcessData(ref DTPrint); if (SysPara.IsNormalResult == 1) { string normalLevel = Utility.Int32Dbnull(DTPrint.Rows[0]["Sex"], 1) == 1 ? "Normal_Level" : "Normal_LevelW"; ProcessNormalResult(ref DTPrint); //ProcessNormalResult(ref DTPrint, "Test_result", normalLevel, -1, 1, 0, // "binhthuong", false); foreach (DataRow row in DTPrint.Rows) { if ( (row["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM")) || (row["Test_result"].ToString().Trim().ToUpper().Contains("AM")) ) { row["binhthuong"] = -1; } else if ( (row["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ")) || (row["Test_result"].ToString().Trim().ToUpper().Contains("DUO")) ) { row["binhthuong"] = 1; } } } try { reporttype = File.ReadAllText(filereporttype); if (chkA5.Checked) { StrCode = reporttype; } else if (chkA4.Checked) { StrCode = reporttype; } } catch (Exception ex) { MessageBox.Show("Loz" + ex, "Thông báo"); } //Tạo list loại xét nghiệm được tick chọn //CrptBusiness.testTypeList.Clear(); //foreach (var row in grdTestType.GetCheckedRows()) //{ // var a = row.Cells["TestType_ID"].Value; // CrptBusiness.testTypeList.Add(Utility.Int32Dbnull(row.Cells["TestType_ID"].Value)); //} string tieude = "", reportname = ""; var crpt = Utility.GetReport("LAOKHOA_crpt_DetailTestReport_TESTTYPE", ref tieude, ref reportname); var objForm = new frmPrintPreview(sTitleReport, crpt, true, DTPrint.Rows.Count <= 0 ? false : true); Utility.UpdateLogotoDatatable(ref DTPrint); try { DTPrint.AcceptChanges(); crpt.SetDataSource(DTPrint); objForm.crptViewer.ReportSource = crpt; ////crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " PHÒNG TIẾP ĐÓN ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); objForm.crptTrinhKyName = Path.GetFileName(reportname); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(NgayIn)); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.ShowDialog(); // Utility.DefaultNow(this); } catch (Exception ex) { if (globalVariables.IsAdmin) { Utility.ShowMsg(ex.ToString()); } } //StrCode = reporttype.Trim(); //// neu rpt A4 hoac A5 ma chua khai bao thi lay me no cai mac dinh(.) //if (StrCode == "") //{ // crptBusiness.StrCode = rdoNoheader.Checked ? "LABNOHEADER" : "LABREPORT"; //} //else //{ // crptBusiness.StrCode = StrCode; //} //crptBusiness.FormPreviewTitle = "In kết quả xét nghiệm"; //crptBusiness.Print(IsQuick, printDocument.PrinterSettings.PrinterName); }
/// <summary> /// HAM THUC HIEN XOA NHIEU LUA CHON /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdDeleteALL_Click(object sender, EventArgs e) { try { if (_currentGRd == null) { return; } SqlQuery q; bool b_FlagService = false; if (!Utility.isValidCheckedGrid(_currentGRd)) { Utility.ShowMsg("Bạn cần check chọn ít nhất một dịch vụ trên lưới trước khi xóa"); return; } if (_currentGRd.GetCheckedRows().Length <= 0) { Utility.ShowMsg("Bạn phải chọn một dịch vụ thực hiện xoá", "Thông báo"); _currentGRd.Focus(); return; } string lsterr = ""; if (_currentGRd.CurrentRow != null) { if (Utility.AcceptQuestion("Bạn có muốn xoá các dịch vụ đang chọn không", "Thông báo", true)) { foreach (Janus.Windows.GridEX.GridEXRow gridExRow in _currentGRd.GetCheckedRows()) { int _IdChitietdichvu = Utility.Int32Dbnull(gridExRow.Cells[DmucDichvuclsChitiet.Columns.IdChitietdichvu].Value, -1); v_ServiceDetail_Id = Utility.Int32Dbnull(grdChitiet.CurrentRow.Cells[DmucDichvuclsChitiet.Columns.IdChitietdichvu].Value, -1); KcbChidinhclsChitiet item = new Select().From(KcbChidinhclsChitiet.Schema).Where(KcbChidinhclsChitiet.Columns.IdChitietdichvu).IsEqualTo(v_ServiceDetail_Id).ExecuteSingle <KcbChidinhclsChitiet>(); if (item != null) { lsterr = lsterr + Utility.sDbnull(gridExRow.Cells[DmucDichvuclsChitiet.Columns.TenChitietdichvu].Value, "") + ";"; } else { SPs.DmucXoadanhmucDichvuclsChitiet(_IdChitietdichvu).Execute(); gridExRow.Delete(); _currentGRd.UpdateData(); _currentGRd.Refetch(); dsTable.Select(DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + _IdChitietdichvu)[0].Delete(); dsTable.AcceptChanges(); } } if (Utility.DoTrim(lsterr) != "") { Utility.ShowMsg("Một số dịch vụ chi tiết sau đã có chi tiết nên bạn không thể xóa\n" + lsterr); } } dsTable.AcceptChanges(); } } catch (Exception) { } finally { ModifyCommand(); } }
string getCheckedvalue(GridEX grd, string fieldName) { string reval = ""; try { foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grd.GetCheckedRows()) { reval += Utility.sDbnull(gridExRow.Cells[fieldName].Value, "") + ","; } if (reval != "") reval= reval.Substring(0, reval.Length - 1); return reval; } catch (Exception) { return ""; } }