/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult ExpePlanEdit(E_tb_ExpePlan eExpePlan, string EditType, int?InfoID) { ViewData["PlanTypeList"] = this.GetPlanTypeList(false); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false); ViewData["PersonnelList"] = PageTools.GetSelectList(tInPersonnel.GetList(" AreaID=" + CurrentUserInfo.AreaID.ToString()).Tables[0], "PersonnelID", "PersonnelName", false); //ViewData["SampleList"] = PageTools.GetSelectList(tSample.GetList(" (handleUser='' or handleUser is null) order by id ").Tables[0], "id", "name", false); ViewBag.PersonnelID = CurrentUserInfo.PersonnelID; ViewBag.AreaAddr = tArea.GetModel(int.Parse(CurrentUserInfo.AreaID.ToString())).AreaName; ViewBag.SampleID = 0; ViewBag.ProjectID = 0; if (EditType == "Edit") { eExpePlan = tExpePlan.GetModel(Convert.ToInt32(InfoID)); ViewBag.SampleID = eExpePlan.SampleID; ViewBag.ProjectID = eExpePlan.ProjectID; } //默认获取前200条数据,避免因option过多导致加载过慢 List <tb_Sample> SampleList = _dSample.GetModelList(400, "id,name", " where handleUser=0", eExpePlan.SampleID != null ? Convert.ToInt32(eExpePlan.SampleID) : 0); ViewData["SampleList"] = SampleList; eExpePlan.EditType = EditType; return(View(eExpePlan)); }
D_tb_InPersonnel dInPersonnel = new D_tb_InPersonnel();//人员管理 // // GET: /DetectProject/ public ActionResult ExpePlanList(E_PageParameter ePageParameter) { int pageIndex = Utils.GetInt(Request["page"]); ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex; ePageParameter.pagesize = 20; ViewBag.ExpePlanList = this.GetList(ePageParameter); ViewBag.PersonnelList = dInPersonnel.GetList(new E_tb_InPersonnel() { }); ViewBag.ePageParameter = ePageParameter; ViewBag.page = Utils.ShowPage(ePageParameter.count, ePageParameter.pagesize, pageIndex, 5); ViewData["PlanTypeList"] = this.GetPlanTypeList(true); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true); ViewData["AreaList"] = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true); return(View("/views/ExpePlan/ExpePlanList.cshtml")); //if (Request["ApprovalPersonnelName"] != null) // ViewData["ApprovalPersonnelName"] = Request["ApprovalPersonnelName"].ToString(); //else // ViewData["ApprovalPersonnelName"] = ""; //ViewBag._userName = CurrentUserInfo.UserName; //eExpePlan.AreaID = CurrentUserInfo.AreaID; //ViewBag.IsDisabled = (CurrentUserInfo.RoleID != 1) ? "true" : "false"; //权限判断 }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string EntrustCompany, string SampleName, string ProjectID, string TaskNo, string SubmissionTimeStart, string SubmissionTimeEnd) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(EntrustCompany))//送检单位 { strWhere = PageTools.AddWhere(strWhere, "EntrustCompany like '%" + EntrustCompany + "%' "); } if (!string.IsNullOrEmpty(SampleName))//样品名称 { strWhere = PageTools.AddWhere(strWhere, "B.name like '%" + SampleName + "%' "); } if (!string.IsNullOrEmpty(ProjectID) && ProjectID != "-1")//检验项目 { strWhere = PageTools.AddWhere(strWhere, " T.ProjectID=" + ProjectID); } if (!string.IsNullOrEmpty(TaskNo))//任务单号 { strWhere = PageTools.AddWhere(strWhere, "TaskNo like '%" + TaskNo + "%' "); } if (!string.IsNullOrEmpty(SubmissionTimeStart))//起始送检日期 { strWhere = PageTools.AddWhere(strWhere, "T.SubmissionTime>=cast('" + SubmissionTimeStart + "' as datetime) "); } if (!string.IsNullOrEmpty(SubmissionTimeEnd))//结束送检日期 { strWhere = PageTools.AddWhere(strWhere, "T.SubmissionTime<=cast('" + SubmissionTimeEnd + "' as datetime) "); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere += (strWhere.Length > 0 ? " and " : "") + " T.AreaID=" + CurrentUserInfo.AreaID; break; case 3: //个人 strWhere += (strWhere.Length > 0 ? " and " : "") + " T.EditPersonnelID=" + CurrentUserInfo.PersonnelID; break; } try { dt = tEntrustMeterage.GetListByPage(strWhere, "", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult OutsourcingTestingEdit(E_tb_OutsourcingTesting eOutsourcingTesting, string EditType, int?InfoID) { if (EditType == "Edit") { eOutsourcingTesting = tOutsourcingTesting.GetModel(Convert.ToInt32(InfoID)); } eOutsourcingTesting.EditType = EditType; ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false); ViewData["SampleList"] = PageTools.GetSelectList(tSample.GetList("").Tables[0], "id", "name", false); return(View(eOutsourcingTesting)); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult EntrustTestingEdit(E_tb_EntrustTesting eEntrustTesting, string EditType, int?InfoID) { if (EditType == "Edit") { eEntrustTesting = tEntrustTesting.GetModel(Convert.ToInt32(InfoID)); } eEntrustTesting.EditType = EditType; ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false); ViewData["SampleList"] = PageTools.GetSelectList(tSample.GetList("handleUser is null").Tables[0], "id", "name", false); ViewData["PersonnelList"] = PageTools.GetSelectList(tInPersonnel.GetList("").Tables[0], "PersonnelID", "PersonnelName", false); return(View(eEntrustTesting)); }
public ActionResult OriginalRecordReport(int?ProjectID) { E_tb_RecordSample eRecordSample = new E_tb_RecordSample(); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true); ViewData["SampleData"] = new DataTable(); if (ProjectID != null && ProjectID > 0) { eRecordSample.ProjectID = Convert.ToInt32(ProjectID); ViewData["SampleData"] = tRecordSample.GetSampleByProjectID(Convert.ToInt32(ProjectID)).Tables[0]; } return(View(eRecordSample)); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult DetectProjectEdit(E_tb_DetectProject eDetectProject, int LaboratoryID, string EditType, int?InfoID) { ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false); ViewData["PersonnelList"] = PageTools.GetSelectList(tInPersonnel.GetList("").Tables[0], "PersonnelID", "PersonnelName", false); if (EditType == "Edit") { eDetectProject = tDetectProject.GetModel(Convert.ToInt32(InfoID)); } eDetectProject.EditType = EditType; eDetectProject.LaboratoryID = LaboratoryID; return(View(eDetectProject)); }
/// <summary> /// 上传图片 /// </summary> /// <returns></returns> /// liuyicong 2017-01-17 public ActionResult Upload() { HttpFileCollection imgFiles = System.Web.HttpContext.Current.Request.Files; //var imgFiles = Request.Files; if (imgFiles.Count == 0) { return(Json(new { code = 1, msg = "请选择要上传的文件!" })); } var img = imgFiles[0]; if (img != null) { var ex = Path.GetExtension(img.FileName); var name = Guid.NewGuid().ToString("N"); var aPath = DateTime.Now.ToString("yyyy/MM/dd/temp") + "/" + name + "_temp" + ex; var aPath2 = DateTime.Now.ToString("yyyy/MM/dd") + "/" + name + ex; string filePathTemp = "~/Files/UploadCampaignImages/" + aPath; string filePath = "~/Files/UploadCampaignImages/" + aPath2; if (!Directory.Exists(Path.GetDirectoryName(Server.MapPath(filePathTemp)))) { Directory.CreateDirectory(Path.GetDirectoryName(Server.MapPath(filePathTemp))); img.SaveAs(Server.MapPath(filePathTemp)); } else { img.SaveAs(Server.MapPath(filePathTemp)); } string json = "{{\"code\":\"{0}\",\"msg\":\"{1}\",\"url\":\"{2}\",\"serverUrl\":\"{3}\",\"smallUrl\":\"{4}\"}}"; string smallpath = ""; var c = SizeImage(filePathTemp, filePath, out smallpath); if (c == "上传成功") { var s = Content(string.Format(json, "200", "上传成功", filePath.Replace("~", ""), PageTools.GetHttpUrl(filePath), smallpath)); return (s); } else { return(Json(new { code = 4, msg = c }, "text/html")); } } return(Json(new { code = 3, msg = "上传失败" }, "text/html")); }
T_tb_TestReportData tTestReportData = new T_tb_TestReportData(); //检验报告数据 // // GET: /Laboratory/ public ActionResult OriginalRecordList(E_PageParameter ePageParameter) { int pageIndex = Utils.GetInt(Request["page"]); ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex; ePageParameter.pagesize = 20; ViewData["AreaList"] = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true); ViewBag.OriginalRecordList = this.GetList(ePageParameter); ViewBag.ePageParameter = ePageParameter; ViewBag.page = Utils.ShowPage(ePageParameter.count, ePageParameter.pagesize, pageIndex, 5); return(View("/views/OriginalRecord/OriginalRecordList.cshtml")); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult LaboratoryEdit(E_tb_Laboratory eLaboratory, string EditType, int?InfoID) { ViewData["AreaList"] = GetAreaList(); DataTable typelist = tTypeDict.GetList("SubjectID=4").Tables[0]; ViewData["LaboratoryTypeList"] = PageTools.GetSelectList(typelist, "TypeID", "TypeName", false); if (EditType == "Edit") { eLaboratory = tLaboratory.GetModel(Convert.ToInt32(InfoID)); } eLaboratory.UserAreaID = Convert.ToInt32(CurrentUserInfo.AreaID); eLaboratory.UserDataRange = CurrentUserInfo.DataRange; eLaboratory.EditType = EditType; return(View(eLaboratory)); }
public IViewComponentResult Invoke(IFormCollection Inputs) { List <OptionEntity> Options; if (Inputs == null) { Options = OptionHelper.ReadEntities(); } else { Options = PageTools.ExtractOption(Inputs); OptionHelper.UpdateEntities(Options); TempData["Message"] = "Success"; } return(View(Options)); }
public List <CollectDataViewModels> GetViewListByPage( int userId, int collector, int sensor, DateTime timeStart, DateTime timeEnd, out int sum, out int totalCount, int pageIndex, int pageSize = 10) { CollectDataMan collectDataMan = new CollectDataMan(); var ds = collectDataMan.SearchAllByUserId(userId, timeStart, timeEnd, collector, sensor); List <CollectDataViewModels> t = PageTools.DataSetToIList <CollectDataViewModels>(ds, 0).ToList(); totalCount = t.Count(); sum = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1; return(t.Take(pageSize * pageIndex).Skip(pageSize * (pageIndex - 1)).ToList()); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult ExpePlanEdit(E_tb_ExpePlan eExpePlan, string EditType, int?InfoID) { ViewData["PlanTypeList"] = this.GetPlanTypeList(false); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", false); ViewData["PersonnelList"] = PageTools.GetSelectList(tInPersonnel.GetList(" AreaID=" + CurrentUserInfo.AreaID.ToString()).Tables[0], "PersonnelID", "PersonnelName", false); ViewData["SampleList"] = PageTools.GetSelectList(tSample.GetList(" handleUser='' order by id ").Tables[0], "id", "name", false); ViewBag.PersonnelID = CurrentUserInfo.PersonnelID; ViewBag.AreaAddr = tArea.GetModel(int.Parse(CurrentUserInfo.AreaID.ToString())).AreaName; ViewBag.SampleID = 0; ViewBag.ProjectID = 0; if (EditType == "Edit") { eExpePlan = tExpePlan.GetModel(Convert.ToInt32(InfoID)); ViewBag.SampleID = eExpePlan.SampleID; ViewBag.ProjectID = eExpePlan.ProjectID; } eExpePlan.EditType = EditType; return(View(eExpePlan)); }
// // GET: /DetectProject/ public ActionResult ExpePlanList(E_tb_ExpePlan eExpePlan) { ViewData["PlanTypeList"] = this.GetPlanTypeList(true); ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true); ViewData["AreaList"] = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true); if (Request["ApprovalPersonnelName"] != null) { ViewData["ApprovalPersonnelName"] = Request["ApprovalPersonnelName"].ToString(); } else { ViewData["ApprovalPersonnelName"] = ""; } ViewBag._userName = CurrentUserInfo.UserName; eExpePlan.AreaID = CurrentUserInfo.AreaID; ViewBag.IsDisabled = (CurrentUserInfo.RoleID != 1) ? "true" : "false"; //权限判断 return(View(eExpePlan)); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int LaboratoryID, int pageNumber, int pageSize, string StrSearch, string Searchtype, string txt_StartTime, string txt_EndTime) { DataTable dt = new DataTable(); int total = 0; string strWhere = " T.LaboratoryID=" + LaboratoryID; if (!string.IsNullOrEmpty(txt_StartTime)) { strWhere = PageTools.AddWhere(strWhere, "T.DetectTime>=cast('" + txt_StartTime + "' as datetime) "); } if (!string.IsNullOrEmpty(txt_EndTime)) { strWhere = PageTools.AddWhere(strWhere, "T.DetectTime<=cast('" + txt_EndTime + "' as datetime) "); } if (StrSearch != null && StrSearch.Trim() != "") { switch (Searchtype) { case "1": //检测项目 strWhere += " and T.ProjectName like '%" + StrSearch.Trim() + "%'"; break; case "2": //负责人 strWhere += " and T.MainPerson like '%" + StrSearch.Trim() + "%'"; break; } } try { dt = tDetectProject.GetListByPage(strWhere, "", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string AreaID, string ProjectName, string ExpeType, string ProjectTypeID, string LaboratoryID) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(AreaID) && AreaID.Trim() != "-1") //区域ID { strWhere = PageTools.AddWhere(strWhere, "AreaID=" + AreaID); } if (!string.IsNullOrEmpty(ProjectName))//项目名称 { strWhere = PageTools.AddWhere(strWhere, "ProjectName like '%" + ProjectName + "%'"); } if (!string.IsNullOrEmpty(ExpeType))//检验类型 { strWhere = PageTools.AddWhere(strWhere, "ExpeType like '%" + ExpeType + "%'"); } if (!string.IsNullOrEmpty(ProjectTypeID) && ProjectTypeID.Trim() != "-1")//项目类别ID { strWhere = PageTools.AddWhere(strWhere, "ProjectTypeID=" + ProjectTypeID); } if (!string.IsNullOrEmpty(LaboratoryID) && LaboratoryID.Trim() != "-1")//实验室ID { strWhere = PageTools.AddWhere(strWhere, "LaboratoryID=" + LaboratoryID); } try { dt = tProject.GetListByPage(strWhere, "", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, int FileType, int ParentID) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; strWhere = PageTools.AddWhere(strWhere, "FileType=" + FileType); strWhere = PageTools.AddWhere(strWhere, "ParentID=" + ParentID); try { dt = tFileList.GetListByPage(strWhere, "FileID Desc", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string StrSearch) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(StrSearch)) { strWhere = PageTools.AddWhere(strWhere, "MagazineName like '%" + StrSearch + "%' "); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere += (strWhere.Length > 0 ? " and " : "") + " AreaID=" + CurrentUserInfo.AreaID; break; case 3: //个人 strWhere += (strWhere.Length > 0 ? " and " : "") + " EditPersonnelID=" + CurrentUserInfo.PersonnelID; break; } try { dt = tElectronicsMagazine.GetListByPage(strWhere, "AddTime Desc", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string AreaID, string StartTime, string EndTime, string SampleNum, string SampleName, string Department, string MainTestPersonne, string ReportID, string SamplingTimes, string SamplingTimee) { Session["_AreaID"] = AreaID; Session["_StartTime"] = StartTime; Session["_EndTime"] = EndTime; Session["_SampleNum"] = SampleNum; Session["_SampleName"] = SampleName; Session["_Department"] = Department; Session["_MainTestPersonne"] = MainTestPersonne; Session["_SamplingTimes"] = SamplingTimes; Session["_SamplingTimee"] = SamplingTimee; Session["_ReportID"] = ReportID; DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(ReportID) && ReportID != "0") { strWhere = PageTools.AddWhere(strWhere, "T.ReportID=" + ReportID); } if (!string.IsNullOrEmpty(AreaID) && AreaID != "-1") { strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + AreaID); } if (!string.IsNullOrEmpty(StartTime)) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime>=cast('" + StartTime + "' as datetime)"); } if (!string.IsNullOrEmpty(EndTime)) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime<=cast('" + EndTime + "' as datetime)"); } if (!string.IsNullOrEmpty(SampleNum)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleNum like '%" + SampleNum + "%'"); } if (!string.IsNullOrEmpty(SampleName)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleName like '%" + SampleName + "%'"); } if (!string.IsNullOrEmpty(Department)) { strWhere = PageTools.AddWhere(strWhere, "T.Department like '%" + Department + "%'"); } if (!string.IsNullOrEmpty(MainTestPersonne)) { strWhere = PageTools.AddWhere(strWhere, "D.PersonnelName like '%" + MainTestPersonne + "%'"); } if (!string.IsNullOrEmpty(SamplingTimes)) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime>=cast('" + SamplingTimes + "' as datetime)"); } if (!string.IsNullOrEmpty(SamplingTimee)) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime<=cast('" + SamplingTimee + "' as datetime)"); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " "); break; case 3: //个人 strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " "); break; } try { //dt = tTestReport.GetListByPage(strWhere, "UpdateTime DESC,T.SampleName ASC", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; dt = tTestReport.GetListByPage(strWhere, "TestTime DESC", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ApprovalPersonnelName = dt.Rows[i]["ApprovalPersonnelName"].ToString(); string RecordIDS = dt.Rows[i]["RecordIDS"].ToString(); StringBuilder strRecordIDS = new StringBuilder(); if (!string.IsNullOrEmpty(RecordIDS)) { string[] ArrRecordIDS = RecordIDS.Split(','); foreach (string item in ArrRecordIDS) { if (!string.IsNullOrEmpty(item)) { strRecordIDS.Append(string.Format("<a href='/OriginalRecord/OriginalRecordList?RecordID={0}&ApprovalPersonnelName={1}' style='color:Blue; font-weight:bold;'>{0}</a>,", item, ApprovalPersonnelName)); } } } dt.Rows[i]["RecordIDS"] = strRecordIDS.ToString().TrimEnd(','); string TaskNoS = dt.Rows[i]["TaskNoS"].ToString(); StringBuilder strTaskNoS = new StringBuilder(); if (!string.IsNullOrEmpty(TaskNoS)) { string[] ArrTaskNoS = TaskNoS.Split(','); foreach (string item in ArrTaskNoS) { if (!string.IsNullOrEmpty(item)) { strTaskNoS.Append(string.Format("<a href='/ExpePlan/ExpePlanList?PlanID={0}&ApprovalPersonnelName={1}' style='color:Blue; font-weight:bold;'>{0}</a>,", item, ApprovalPersonnelName)); } } } dt.Rows[i]["TaskNoS"] = strTaskNoS.ToString().TrimEnd(','); } } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
T_tb_ExpePlan tExpePlan = new T_tb_ExpePlan(); //实验计划管理 // // GET: /Laboratory/ public ActionResult TestReportList(E_tb_TestReport eTestReport) { ViewData["AreaList"] = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true); ViewBag._userName = CurrentUserInfo.UserName; return(View(eTestReport)); }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult TestReportEdit(E_tb_TestReport eTestReport, string EditType, int?InfoID) { //ViewData["RecordList"] = tOriginalRecord.GetList("").Tables[0]; ViewData["_abclist"] = PageTools.GetSelectList(tTypeDict.GetList("SubjectID=5").Tables[0], "TypeID", "TypeName", false); ViewData["RecordSelect"] = new DataTable(); ViewData["ReportDataList"] = new DataTable(); ViewBag._userName = CurrentUserInfo.UserName; if (EditType == "Edit") { eTestReport = tTestReport.GetModel(Convert.ToInt32(InfoID)); //ViewData["RecordList"] = tOriginalRecord.GetList("RecordID not in (" + eTestReport.RecordIDS + ")").Tables[0]; //ViewData["RecordSelect"] = tOriginalRecord.GetList("RecordID in (" + eTestReport.RecordIDS + ")").Tables[0]; ViewData["ReportDataList"] = tTestReportData.GetList("ReportID=" + eTestReport.ReportID).Tables[0]; //检验数据 E_tb_InPersonnel eInPersonnel = null; if (eTestReport.ApprovalPersonnelID != null && eTestReport.ApprovalPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.ApprovalPersonnelID)); eTestReport.ApprovalPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (eTestReport.examinePersonnelID != null && eTestReport.examinePersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.examinePersonnelID)); eTestReport.examinePersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (eTestReport.MainTestPersonnelID != null && eTestReport.MainTestPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.MainTestPersonnelID)); eTestReport.MainTestPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (string.IsNullOrEmpty(eTestReport.Explain)) { eTestReport.Explain = @" 一、 本检验报告复印、涂改无效;封面未加盖检验专用章和无检验专用骑缝章(如2页以上)的检验报告无效。<br/> 二、 检验报告仅对送检、抽检样品负责。<br/> 三、 本检验报告及检验单位名称不得用于产品的标签、广告评优及商品宣传等。<br/> 四、 本检验报告一式二份,一份由检验单位存档,一份交送检、抽检单位。<br/> 五、 本检验报告由出具报告单位负责,并进行解释说明。<br/> 六、 检验单位保存该检验报告6年。<br/><br/>" ; if (eTestReport.MainTestPersonnelID > 0) { try { eInPersonnel = tInPersonnel.GetModel(eTestReport.MainTestPersonnelID.Value); var _areaid = (eInPersonnel != null ? eInPersonnel.AreaID : 0); if (_areaid > 0) { switch (_areaid) { case 2: { eTestReport.Explain += @"食品检测中心<br/> 检验单位地址:天津市塘沽区东沽石油新村配餐采购加工中心院内<br/> 邮政编码:300452<br/> 联系电话:022-66917343<br/> 传真:022-66917343<br/><br/>"; break; } case 3: { eTestReport.Explain += @"食品检测中心(葫芦岛)<br/> 检验单位地址:辽宁省葫芦岛市龙港区北港码头配餐公司葫芦岛配送基地<br/> 邮政编码:125000<br/> 联系电话:0429-2080522<br/> 传真:0429-2082522<br/><br/>"; break; } case 4: { eTestReport.Explain += @"食品检测中心(深圳)<br/> 检验单位地址:广东省惠州市大亚湾区石化大道中滨海十二路9号惠州物流基地W18<br/> 邮政编码:516082<br/> 联系电话:0752-5952819<br/> 传真:0752-5952818<br/><br/>"; break; } case 5: { eTestReport.Explain += @"食品检测中心(湛江)<br/> 检验单位地址:广东省湛江市坡头区南油一区配餐服务公司湛江分公司<br/> 邮政编码:524057<br/> 联系电话:0759-3910316<br/> 传真:0759-3901145<br/><br/>"; break; } case 6: { eTestReport.Explain += @"食品检测中心(龙口)<br/> 检验单位地址::山东省烟台市龙口市环海中路中海油物流码头配餐公司龙口配送基地<br/> 邮政编码:265700<br/> 联系电话:0535-8838131<br/> 传真:0535-8838131<br/><br/>"; break; } } } } catch { } } } } ViewBag.SampleName = eTestReport.SampleName; if (eTestReport.SampleName.ToString().IndexOf(')') > -1) { ViewBag.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1); } else { ViewBag.SampleName = Regex.Replace(ViewBag.SampleName, @"[^\u4e00-\u9fa5|(|)]", ""); } ViewBag.AreaName = tArea.GetModel(int.Parse(eTestReport.AreaID.ToString())).TestReportName; var sampleModel = new BLL.tb_SampleBLL().GetModelList(" sampleNum = '" + eTestReport.SampleNum + "'").FirstOrDefault(); ViewBag._cydw = "none"; ViewBag._sydw = "none"; if (sampleModel.isDetection) { eTestReport.ToSampleMode = "抽样"; ViewBag._cydw = ""; } else { eTestReport.ToSampleMode = "送样"; ViewBag._sydw = ""; } ViewBag.Department = eTestReport.Department; var _orlist = new BLL.OriginalRecord.T_tb_OriginalRecord().GetModelList(" RecordID in (" + eTestReport.RecordIDS + ")"); String _projectIds = ""; int _tempProjectId = 0; for (int i = 0; i < _orlist.Count; i++) { if (_tempProjectId == _orlist[i].ProjectID) { continue; } if (String.IsNullOrEmpty(_projectIds)) { _projectIds = _orlist[i].ProjectID.ToString(); } else { _projectIds += "," + _orlist[i].ProjectID.ToString(); } } eTestReport.TestBasis = ""; var _projectlist = new BLL.Laboratory.T_tb_Project().GetModelList(" ProjectID in (" + _projectIds + ")"); foreach (var item in _projectlist) { if (String.IsNullOrEmpty(eTestReport.TestBasis)) { eTestReport.TestBasis = item.ExpeMethod; } else { eTestReport.TestBasis += "," + item.ExpeMethod; } } //ViewBag.Department = ""; //if (sampleModel != null) //{ // if (sampleModel.isDetection) // { // ViewBag.Department = sampleModel.detectionCompany; // } // else // { // var clint = new BLL.ClientManage.T_tb_ClientManage().GetModel(Convert.ToInt32(sampleModel.InspectCompany)); // ViewBag.Department = clint.ClientName; // } //} ViewBag._TestType = ""; if (eTestReport.TestType != null) { ViewBag._TestType = tTypeDict.GetModel(int.Parse(eTestReport.TestType.ToString())).TypeName; } //ViewBag.TestTime = eTestReport.TestTime == null ? "" : Convert.ToDateTime(eTestReport.TestTime).ToString("yyyy/MM/dd"); ViewBag.TestTime = eTestReport.IssuedTime == null ? "" : Convert.ToDateTime(eTestReport.IssuedTime).ToString("yyyy/MM/dd"); ViewBag.DetectPersonnelID = CurrentUserInfo.PersonnelID; ViewBag.DetectPersonnelName = CurrentUserInfo.PersonnelName; if (string.IsNullOrEmpty(eTestReport.Remarks)) { eTestReport.Remarks = "无"; } eTestReport.EditType = EditType; return(View(eTestReport)); }
/// <summary> /// 获取列表查询条件 /// </summary> public string GetWhere(E_PageParameter ePageParameter) { string strWhere = ""; if (ePageParameter.reportid > 0) { strWhere = PageTools.AddWhere(strWhere, "T.ReportID=" + ePageParameter.reportid); } if (ePageParameter.areaid > 0) { strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + ePageParameter.areaid); } if (ePageParameter.issuedtimestart != null) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime>=cast('" + ePageParameter.issuedtimestart.ToString() + "' as datetime)"); } if (ePageParameter.issuedtimeend != null) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime<=cast('" + ePageParameter.issuedtimeend.ToString() + "' as datetime)"); } if (!string.IsNullOrEmpty(ePageParameter.samplenum)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleNum like '%" + ePageParameter.samplenum + "%'"); } if (!string.IsNullOrEmpty(ePageParameter.samplename)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleName like '%" + ePageParameter.samplename + "%'"); } if (!string.IsNullOrEmpty(ePageParameter.department)) { strWhere = PageTools.AddWhere(strWhere, "T.Department like '%" + ePageParameter.department + "%'"); } if (!string.IsNullOrEmpty(ePageParameter.maintestpersonne)) { strWhere = PageTools.AddWhere(strWhere, "D.PersonnelName like '%" + ePageParameter.maintestpersonne + "%'"); } if (ePageParameter.samplingtimestart != null) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime>=cast('" + ePageParameter.samplingtimestart.ToString() + "' as datetime)"); } if (ePageParameter.samplingtimeend != null) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime<=cast('" + ePageParameter.samplingtimeend.ToString() + "' as datetime)"); } if (ePageParameter.isexamine == 1) //已审核 { strWhere = PageTools.AddWhere(strWhere, "T.examinePersonnelID>0"); } else if (ePageParameter.isexamine == 2) //未审核 { strWhere = PageTools.AddWhere(strWhere, "(T.examinePersonnelID is null or T.examinePersonnelID=0)"); } if (ePageParameter.isapproval == 1) //已批准 { strWhere = PageTools.AddWhere(strWhere, "T.ApprovalPersonnelID>0"); } else if (ePageParameter.isapproval == 2) //未批准 { strWhere = PageTools.AddWhere(strWhere, "(T.ApprovalPersonnelID is null or T.ApprovalPersonnelID=0)"); } if (ePageParameter.expeplannopass > 0) //是否查询未完成的实验计划 { strWhere = PageTools.AddWhere(strWhere, "(T.ApprovalPersonnelID is null or T.ApprovalPersonnelID=0 or T.examinePersonnelID is null or T.examinePersonnelID=0 or T.MainTestPersonnelID is null or T.MainTestPersonnelID=0)"); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " "); break; case 3: //个人 strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " "); break; } //保密数据获取,只有设置保密的自己或者指定的审核人能看到对应的保密数据 strWhere = PageTools.AddWhere(strWhere, $"(issecrecy=0 or secrecyexaminepid={CurrentUserInfo.PersonnelID} or setsecrecypid={CurrentUserInfo.PersonnelID})"); return(strWhere); }
public FilePathResult ExpAllPDF() { string AreaID = Session["_AreaID"].ToString(); string StartTime = Session["_StartTime"].ToString(); string EndTime = Session["_EndTime"].ToString(); string SampleNum = Session["_SampleNum"].ToString(); string SampleName = Session["_SampleName"].ToString(); string Department = Session["_Department"].ToString(); string MainTestPersonne = Session["_MainTestPersonne"].ToString(); string SamplingTimes = Session["_SamplingTimes"].ToString(); string SamplingTimee = Session["_SamplingTimee"].ToString(); string ReportID = ""; if (Session["_ReportID"] != null) { ReportID = Session["_ReportID"].ToString(); } DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(ReportID) && ReportID != "0") { strWhere = PageTools.AddWhere(strWhere, "T.ReportID=" + ReportID); } if (!string.IsNullOrEmpty(AreaID) && AreaID != "-1") { strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + AreaID); } if (!string.IsNullOrEmpty(StartTime)) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime>=cast('" + StartTime + "' as datetime)"); } if (!string.IsNullOrEmpty(EndTime)) { strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime<=cast('" + EndTime + "' as datetime)"); } if (!string.IsNullOrEmpty(SampleNum)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleNum like '%" + SampleNum + "%'"); } if (!string.IsNullOrEmpty(SampleName)) { strWhere = PageTools.AddWhere(strWhere, "T.SampleName like '%" + SampleName + "%'"); } if (!string.IsNullOrEmpty(Department)) { strWhere = PageTools.AddWhere(strWhere, "T.Department like '%" + Department + "%'"); } if (!string.IsNullOrEmpty(MainTestPersonne)) { strWhere = PageTools.AddWhere(strWhere, "D.PersonnelName like '%" + MainTestPersonne + "%'"); } if (!string.IsNullOrEmpty(SamplingTimes)) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime>=cast('" + SamplingTimes + "' as datetime)"); } if (!string.IsNullOrEmpty(SamplingTimee)) { strWhere = PageTools.AddWhere(strWhere, "SamplingTime<=cast('" + SamplingTimee + "' as datetime)"); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " "); break; case 3: //个人 strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " "); break; } try { //dt = tTestReport.GetListByPage(strWhere, "UpdateTime DESC,T.SampleName ASC", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; dt = tTestReport.GetListByPage(strWhere, "TestTime DESC", 1, 10000, ref total).Tables[0]; } catch { } string[] iFile = new string[1]; if (dt != null && dt.Rows.Count > 0) { iFile = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { ProcessStartInfo Pss = new ProcessStartInfo(); Pss.FileName = Server.MapPath("/HtmlToPDF/wkhtmltopdf.exe"); string strUrl = System.Configuration.ConfigurationManager.AppSettings["HostName"].ToString() + "/ReportView/TestReportView?ReportID=" + dt.Rows[i]["ReportID"];//Request.UserHostName var eTestReport = tTestReport.GetModel(Convert.ToInt32(dt.Rows[i]["ReportID"])); //string FileName = Guid.NewGuid() + ".pdf"; string FileName = UrnHtml(eTestReport.SampleNum) + ".pdf"; string FilePath = Server.MapPath("/TestReportPDF/" + FileName); Pss.Arguments = string.Format("{0} {1}", "\"" + strUrl + "\"", "\"" + FilePath + "\""); Pss.UseShellExecute = false; Pss.RedirectStandardInput = true; Pss.RedirectStandardOutput = true; bool bresult = false; using (Process PS = new Process()) { PS.StartInfo = Pss; PS.Start(); PS.WaitForExit(); if (PS.ExitCode == 0) { bresult = true; PS.Close(); } } iFile[i] = FilePath; } } var strs = DateTime.Now.ToFileTime().ToString(); string oFile = AppDomain.CurrentDomain.BaseDirectory + "UpFile//DownLoads//" + strs + ".zip"; PublicClass.CompressFiles(iFile, oFile); return(File(oFile, "application/octet-stream", strs + ".zip")); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string EntrustCompany, string SampleName, string ProjectID, string TaskNo, string SubmissionTimeStart, string SubmissionTimeEnd) { DataTable dt = new DataTable(); int total = 0; string strWhere = "B.handleUser is null"; //已销毁的样品 对应的委托检验不显示 if (!string.IsNullOrEmpty(EntrustCompany)) //送检单位 { strWhere = PageTools.AddWhere(strWhere, "EntrustCompany like '%" + EntrustCompany + "%' "); } if (!string.IsNullOrEmpty(SampleName))//样品名称 { strWhere = PageTools.AddWhere(strWhere, "B.name like '%" + SampleName + "%' "); } if (!string.IsNullOrEmpty(ProjectID) && ProjectID != "-1")//检验项目 { strWhere = PageTools.AddWhere(strWhere, " T.ProjectID=" + ProjectID); } if (!string.IsNullOrEmpty(TaskNo))//任务单号 { strWhere = PageTools.AddWhere(strWhere, "TaskNo like '%" + TaskNo + "%' "); } if (!string.IsNullOrEmpty(SubmissionTimeStart))//起始送检日期 { strWhere = PageTools.AddWhere(strWhere, "SubmissionTime>=cast('" + SubmissionTimeStart + "' as datetime) "); } if (!string.IsNullOrEmpty(SubmissionTimeEnd))//结束送检日期 { strWhere = PageTools.AddWhere(strWhere, "SubmissionTime<=cast('" + SubmissionTimeEnd + "' as datetime) "); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere += (strWhere.Length > 0 ? " and " : "") + " T.AreaID=" + CurrentUserInfo.AreaID; break; case 3: //个人 strWhere += (strWhere.Length > 0 ? " and " : "") + " T.EditPersonnelID=" + CurrentUserInfo.PersonnelID; break; } try { dt = tEntrustTesting.GetListByPage(strWhere, "", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string RecordID = dt.Rows[i]["ReportID"].ToString(); if (RecordID != "0") { dt.Rows[i]["strReportID"] = string.Format("<a href='/TestReport/TestReportList?ReportID={0}' style='color:Blue; font-weight:bold;'>{0}</a>", RecordID); } } } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
// // GET: /Laboratory/ public ActionResult EntrustTestingList() { ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true); return(View()); }
/// <summary> /// 获取所有数据列表 /// 作者:小朱 /// </summary> /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns> public string GetList(int pageNumber, int pageSize, string AreaID, string PlanTypeID, string InspectTimeStart, string InspectTimeEnd, string TaskNo, string ProjectID, string PlanID, string SampleName, string Status) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(PlanID) && PlanID != "0") { strWhere = PageTools.AddWhere(strWhere, "T.PlanID=" + PlanID + " "); } if (!string.IsNullOrEmpty(AreaID))//区域 { strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + AreaID + " "); } if (!string.IsNullOrEmpty(PlanTypeID))//计划类别 { strWhere = PageTools.AddWhere(strWhere, "T.PlanTypeID=" + PlanTypeID + " "); } if (!string.IsNullOrEmpty(InspectTimeStart))//检验开始时间 { strWhere = PageTools.AddWhere(strWhere, "InspectTime>=cast('" + InspectTimeStart + "' as datetime) "); } if (!string.IsNullOrEmpty(InspectTimeEnd))//送检结束时间 { strWhere = PageTools.AddWhere(strWhere, "InspectTime<=cast('" + InspectTimeEnd + "' as datetime) "); } if (!string.IsNullOrEmpty(TaskNo))//任务单号 { strWhere = PageTools.AddWhere(strWhere, "T.TaskNo like '%" + TaskNo.Trim() + "%' "); } if (!string.IsNullOrEmpty(ProjectID))//检验项目 { strWhere = PageTools.AddWhere(strWhere, "T.ProjectID=" + ProjectID + " "); } if (!string.IsNullOrEmpty(SampleName))//样品名称 { strWhere = PageTools.AddWhere(strWhere, "C.name like '%" + SampleName + "%' "); } if (!string.IsNullOrEmpty(Status))//样品名称 { strWhere = PageTools.AddWhere(strWhere, "T.Status =" + Status); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " "); break; case 3: //个人 strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " "); break; } try { dt = tExpePlan.GetListByPage(strWhere, "", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0]; } catch { } string strJson = PublicClass.ToJson(dt, total); if (strJson.Trim() == "") { strJson = "{\"total\":0,\"rows\":[]}"; } return(strJson); }
/// <summary> /// 批量导出 /// </summary> /// <param name="ids"></param> /// <returns></returns> public FilePathResult ExpAllPDF(string ids) { DataTable dt = new DataTable(); int total = 0; string strWhere = ""; if (!string.IsNullOrEmpty(ids)) { strWhere = PageTools.AddWhere(strWhere, $"T.ReportID in ({ids})"); } //添加数据权限判断 switch (CurrentUserInfo.DataRange) { case 2: //区域 strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " "); break; case 3: //个人 strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " "); break; } dt = tTestReport.GetListByPage(strWhere, "TestTime DESC", 1, 10000, ref total).Tables[0]; var strs = "批量下载-"; string[] iFile = new string[1]; if (dt != null && dt.Rows.Count > 0) { iFile = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { ProcessStartInfo Pss = new ProcessStartInfo(); Pss.FileName = Server.MapPath("/HtmlToPDF/wkhtmltopdf.exe"); string strUrl = System.Configuration.ConfigurationManager.AppSettings["HostName"].ToString() + "/ReportView/TestReportView?ReportID=" + dt.Rows[i]["ReportID"];//Request.UserHostName var eTestReport = tTestReport.GetModel(Convert.ToInt32(dt.Rows[i]["ReportID"])); if (i == 0) { strs += eTestReport.SampleName; } string FileName = UrnHtml(eTestReport.SampleNum) + ".pdf"; string FilePath = Server.MapPath("/TestReportPDF/" + FileName); Pss.Arguments = string.Format("{0} {1}", "\"" + strUrl + "\"", "\"" + FilePath + "\""); Pss.UseShellExecute = false; Pss.RedirectStandardInput = true; Pss.RedirectStandardOutput = true; bool bresult = false; using (Process PS = new Process()) { PS.StartInfo = Pss; PS.Start(); PS.WaitForExit(); if (PS.ExitCode == 0) { bresult = true; PS.Close(); } } iFile[i] = FilePath; } } string oFile = AppDomain.CurrentDomain.BaseDirectory + "UpFile//DownLoads//" + strs + ".zip"; PublicClass.CompressFiles(iFile, oFile); return(File(oFile, "application/octet-stream", strs + ".zip")); }