Ejemplo n.º 1
0
        private static void GetPdf(Guid publishKey, string md5, string method)
        {
            Uri url = System.Web.HttpContext.Current.Request.UrlReferrer;

            var file = new FilesBll().SignFiles(md5);

            if (url != null && file != null && url.AbsolutePath.Contains("Pdm/PdfViews"))
            {
                var publish = DataFactory.Database().FindEntity <Published>(publishKey);

                string targetPath = Path.GetFullPath(BaseHelper.PublishedPath);

                if (method == "Showing")
                {
                    BaseHelper.ViewPdf(publish.IsDel ? PdfHelper.PdfToStream(targetPath + md5, true, "mjdrawadm", "mjdrawadm", false, "旧版本保留", "minicutdraw.png") : PdfHelper.PdfToStream(targetPath + md5, true, publish.IsPass ? "minicut*" : null, "mjdrawadm", false, "禁止复印 盖章有效", "minicutdraw.png"));
                }
                else
                {
                    BaseHelper.ViewPdf(publish.IsDel ? PdfHelper.PdfToStream(targetPath + md5, true, null, "mjdrawadm", true, "旧版本保留", "minicutdraw.png") : PdfHelper.PdfToStream(targetPath + md5, true, null, "mjdrawadm", true, "禁止复印 盖章有效", "minicutdraw.png"));
                }
            }
            else
            {
                Link.ErrorBy(new Exception("文件链接错误,请走正常链接..."), typeof(PdmController));
            }
        }
Ejemplo n.º 2
0
        public void Online(string md5, string method)
        {
            string d5 = md5.Decrypt();

            var file = new FilesBll().SignFiles(d5);

            string uppath = BaseHelper.UpPath;



            if (".pdf".Contains(file.FileType))
            {
                //打印与在线查看
                BaseHelper.ViewPdf(method == "print"
                    ? PdfHelper.PdfToStream(uppath + d5, true, null, "mjdrawadm", true, "表单文件",
                                            "minicutdraw.png")
                    : PdfHelper.PdfToStream(uppath + d5, true, null, "mjdrawadm", false, "表单文件",
                                            "minicutdraw.png"));
            }
            else
            {
                Form(md5);
                //   Link.ErrorBy(new Exception(string.Format("暂不支持{0}文件在线查看,请等待开发...", file.FileType)));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 发行文件预览页
        /// </summary>
        /// <param name="publishKey"></param>
        /// <param name="md5"></param>
        /// <returns></returns>
        public ActionResult PdfViews(Guid publishKey, string md5)
        {
            //update visit
            Task.Run(() => new Quality().PdfView(publishKey, md5));

            var publish = new BaseServices <Published>().LoadEntities(c => c.PubishedGuid == publishKey).FirstOrDefault();

            if (publish != null)
            {
                var          formType = new Applying().GetFormByFormNo(publish.FormNo).FormType;
                DrawingsBase bBase    = new Applying().GetFormEntityByFormNo(publish.FormNo, formType);



                //  var file = BaseServices<Files>().LoadEntities(c => c.Md5 == md5).FirstOrDefault();

                var file = new FilesBll().SignFiles(md5);

                if (file == null || file.FileType != ".pdf")
                {
                    return(Link.ErrorBy(new Exception("暂不支持此文件在线查看"), GetType()));
                }


                var oldRecord = Task.Run(() => new BaseServices <Published>().LoadEntities(
                                             c => c.Identity == publish.Identity && c.PubishedGuid != publish.PubishedGuid).ToList());

                var contiguous = Task.Run(() => new BaseServices <Published>().LoadEntities(
                                              c => c.PublishVer == publish.PublishVer && c.ProductNo == publish.ProductNo && c.PubishedGuid != publish.PubishedGuid).ToList());


                ViewBag.DrawType   = formType.FormName;
                ViewBag.PublishKey = publishKey;
                ViewBag.Md5        = md5;
                ViewBag.File       = file.FileName;
                ViewBag.Base       = bBase;
                ViewBag.OldRecord  = oldRecord.Result;
                ViewBag.Contiguous = contiguous.Result;
            }

            return(View("/Areas/eSystem/Views/Pdm/PdfViews.cshtml", publish));
        }