示例#1
0
        private List <TotalSearchCommonReportModel> GetCommonReportDetails(string customId, string reportNum, string itemCode, string id)
        {
            string key = string.Format("{0}{1}{2}", customId, itemCode, reportNum);

            Func <QueryContainerDescriptor <es_t_pkpm_binaryReport>, QueryContainer> filterQuery = q => (q.Terms(t => t.Field(f => f.REPORTNUM).Terms(key))) &&
                                                                                                   q.Exists(qe => qe.Field(qet => qet.REPORTPATH));

            var pkrResponse = pkrESRep.Search(s => s.Index("sh-t-pkpm-pkr").Sort(cs => cs.Descending(csd => csd.UPLOADTIME)).From(0).Size(50).Query(filterQuery));
            List <TotalSearchCommonReportModel> model = new List <TotalSearchCommonReportModel>();

            if (pkrResponse.IsValid)
            {
                int index = 1;
                foreach (var item in pkrResponse.Documents)
                {
                    //过滤无附件的报表
                    if (item.REPORTPATH.IsNullOrEmpty())
                    {
                        continue;
                    }
                    Dictionary <string, string>  dict     = new Dictionary <string, string>();
                    TotalSearchCommonReportModel oneModel = new TotalSearchCommonReportModel();
                    oneModel.index      = index.ToString();
                    oneModel.UpLoadTime = GetUIDtString(item.UPLOADTIME, "yyyy-MM-dd HH:mm:ss");
                    oneModel.ReportNum  = reportNum;
                    oneModel.ReportPath = SymCryptoUtility.Encrypt(item.REPORTPATH);
                    oneModel.Id         = id;
                    index++;
                    model.Add(oneModel);
                }
            }
            return(model);
        }
示例#2
0
        public FileResult Image(ImageViewDownload model)
        {
            string fileName = string.Empty;

            //model.itemValue;
            if (model == null || model.itemValue == null || model.itemValue == "" || model.itemValue == "undefined")
            {
                fileName = string.Empty;
            }
            else
            {
                try
                {
                    fileName = SymCryptoUtility.Decrypt(model.itemValue);
                }
                catch (Exception)
                {
                    fileName = model.itemValue;
                }
            }


            try//照片路径不存在报错(新老数据问题)
            {
                string mimeType = GetMimeMapping(fileName);
                Stream stream   = fileHander.LoadFile(string.Empty, fileName);
                return(new FileStreamResult(stream, mimeType));
            }
            catch (Exception)
            {
                return(null);
            }
        }
示例#3
0
        public ActionResult CommonReportByPath(string path)
        {
            string reportPath    = SymCryptoUtility.Decrypt(path);
            var    imageData     = reportService.GetPdfFromPkr(reportPath);
            var    imageFileName = "报告文件{0}-{1}.pdf".Fmt(DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.Ticks);
            string contentType   = MimeMapping.GetMimeMapping(imageFileName);

            return(new FileContentResult(imageData, contentType));
        }
示例#4
0
        public ActionResult download(string filepath, string fileName)
        {
            var path = SymCryptoUtility.Decrypt(filepath);

            byte[] bytes    = System.IO.File.ReadAllBytes(path);
            string mimeType = MimeMapping.GetMimeMapping(fileName);

            return(File(bytes, mimeType));
        }
示例#5
0
        public ActionResult Details(int id)
        {
            ZNHTYFangAnViewModel model = new ZNHTYFangAnViewModel();
            var progData = HTYRep.GetById(id);

            if (!string.IsNullOrEmpty(progData.filepath))
            {
                progData.filepath = SymCryptoUtility.Encrypt(progData.filepath);
            }
            if (!string.IsNullOrEmpty(progData.hqfilepath))
            {
                progData.hqfilepath = SymCryptoUtility.Encrypt(progData.hqfilepath);
            }

            model.programme = progData;
            var projects = projectRep.GetByCondition(r => r.PROJECTNUM == model.programme.projectnum);//.GetById(id);

            if (projects != null && projects.Count > 0)
            {
                model.project       = projects.First();
                model.PLANSTARTDATE = model.project.PLANSTARTDATE.HasValue ? model.project.PLANSTARTDATE.Value.ToString("yyyy-MM-dd") : string.Empty;
            }

            model.date = (model.programme.planstartdate.HasValue ? model.programme.planstartdate.Value.ToString("yyyy-MM-dd") : string.Empty) + " - " + (model.programme.planenddate.HasValue ? model.programme.planenddate.Value.ToString("yyyy-MM-dd") : string.Empty);
            var allCustoms = checkUnitServce.GetAllCheckUnit();

            model.programme.unitcode = checkUnitServce.GetCheckUnitByIdFromAll(allCustoms, model.programme.unitcode);

            var peopleIds = progData.testingpeople;

            if (!peopleIds.IsNullOrEmpty())
            {
                var peoIds  = peopleIds.Split(',').ToList();
                var peoples = peopleRep.GetByCondition(w => peoIds.Contains(w.id.ToString()));
                model.people = peoples;
            }
            var equipIds = progData.testingequipment;

            if (!equipIds.IsNullOrEmpty())
            {
                var equIds = equipIds.Split(',').ToList();
                var equips = equipRep.GetByCondition(w => equIds.Contains(w.id.ToString()));
                model.EquipNums = equips.Select(s => s.equnum).Join(",");
            }
            return(View(model));
        }
示例#6
0
        public string GetCryptPkrReportNumFromDict(Dictionary <string, int> prkReports, es_t_bp_item item)
        {
            if (prkReports == null || prkReports.Count == 0 || item == null)
            {
                return(string.Empty);
            }

            var esPKRReporNum = BuildPkrReportNum(item);

            if (prkReports.ContainsKey(esPKRReporNum.NormalKey) && prkReports[esPKRReporNum.NormalKey] > 0)
            {
                return(SymCryptoUtility.Encrypt(esPKRReporNum.NormalKey));
            }
            else if (prkReports.ContainsKey(esPKRReporNum.BSKey) && prkReports[esPKRReporNum.BSKey] > 0)
            {
                return(SymCryptoUtility.Encrypt(esPKRReporNum.BSKey));
            }
            else
            {
                return(string.Empty);
            }
        }
示例#7
0
        public string GetClearReportNum(string cryptPkrReportNum)
        {
            var pkrReportNum = SymCryptoUtility.Decrypt(cryptPkrReportNum);

            return(pkrReportNum);
        }