Exemplo n.º 1
0
        /// <summary>
        /// 获取案件文件
        /// </summary>
        /// <returns></returns>
        private void GetFile()
        {
            string wjlj = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["wjlj"].Trim()));
            string wjmc = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["wjmc"].Trim()));

            if (string.IsNullOrEmpty(wjlj) || string.IsNullOrEmpty(wjmc))
            {
                Response.Write("访问参数错误");
            }
            else
            {
                EDRS.BLL.XY_DZJZ_XTPZ   bll   = new EDRS.BLL.XY_DZJZ_XTPZ(this.Request);
                EDRS.Model.XY_DZJZ_XTPZ model = bll.GetModel((int)EnumConfig.卷宗文件下载地址);
                if (model != null)
                {
                    IceServicePrx isp = new IceServicePrx();

                    string msg = "";

                    byte[] bytes = new byte[] { };

                    if (isp.DownFile(model.CONFIGVALUE, wjlj, wjmc, "", ref bytes, ref msg))
                    {
                        string showType = ConfigHelper.GetConfigString("FileShowType");
                        if (showType == "1")
                        {
                            Response.Write("<img style=\"max-width:100%;\" alt=\"\" src=\"data:image/jpeg;base64," + Convert.ToBase64String(bytes) + "\" />");
                        }
                        else
                        {
                            byte[] info = DataEncryption.Decryption(bytes);

                            //MemoryStream ms = new MemoryStream(bytes);  //把那个byte[]数组传进去,然后
                            //File.WriteAllBytes(Server.MapPath("/") + "ddd.pdf", bytes);
                            //FileStream fs = new FileStream(Server.MapPath("/")+"ccc.pdf",FileMode.Append, FileAccess.Write);
                            //ms.WriteTo(fs);
                            //ms.Close();
                            //fs.Close();

                            Response.ContentType = "application/pdf";
                            Response.AddHeader("content-disposition", "filename=pdf");
                            Response.AddHeader("content-length", info.Length.ToString());
                            Response.BinaryWrite(info);
                        }
                    }
                    else
                    {
                        Response.Write(msg);
                    }
                }
                else
                {
                    Response.Write("请先配置" + EnumConfig.卷宗文件下载地址);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取案件文件
        /// </summary>
        /// <returns></returns>
        private void GetFile()
        {
            string wjlj = "";
            string wjmc = "";


            //  string dwbm = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["DWBM"].Trim()));
            //string bh = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["BH"].Trim()));
            string jzbh    = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["JZBH"].Trim()));
            string jzwjybh = HttpUtility.UrlDecode(HttpUtility.UrlDecode(Request["JZWJYBH"].Trim()));

            EDRS.BLL.YX_DZJZ_JZMLWJ bll = new EDRS.BLL.YX_DZJZ_JZMLWJ(HttpContext.Current.Request);
            DataSet ds = bll.GetList(" and JZBH=:JZBH and WJXH=:WJXH", new object[] { jzbh, jzwjybh });

            //判断是否查询出现异常
            if (ds != null && ds.Tables.Count > 0)
            {
                //判断查询没有数据
                if (ds.Tables[0].Rows.Count > 0)
                {
                    wjlj = ds.Tables[0].Rows[0]["WJLJ"].ToString();
                    wjmc = ds.Tables[0].Rows[0]["WJMC"].ToString();
                }
            }

            if (string.IsNullOrEmpty(wjlj) || string.IsNullOrEmpty(wjmc))
            {
                Response.Write("访问参数错误");
            }
            else
            {
                EDRS.BLL.XY_DZJZ_XTPZ   bllto = new EDRS.BLL.XY_DZJZ_XTPZ(this.Request);
                EDRS.Model.XY_DZJZ_XTPZ model = bllto.GetModel((int)EnumConfig.卷宗文件下载地址);
                if (model != null)
                {
                    IceServicePrx isp   = new IceServicePrx();
                    string        msg   = "";
                    byte[]        bytes = new byte[] { };
                    if (isp.DownFile(model.CONFIGVALUE, wjlj, wjmc, "", ref bytes, ref msg))
                    {
                        string showType = ConfigHelper.GetConfigString("FileShowType");
                        if (showType == "1")
                        {
                            Response.Write("<img style=\"max-width:100%;\" alt=\"\" src=\"data:image/jpeg;base64," + Convert.ToBase64String(bytes) + "\" />");
                        }
                        else
                        {
                            byte[] info = DataEncryption.Decryption(bytes);
                            Response.ContentType = "application/pdf";
                            Response.AddHeader("content-disposition", "filename=pdf");
                            Response.AddHeader("content-length", info.Length.ToString());
                            Response.BinaryWrite(info);
                        }
                    }
                    else
                    {
                        Response.Write(msg);
                    }
                }
                else
                {
                    Response.Write("请先配置" + EnumConfig.卷宗文件下载地址);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取案件文件
        /// </summary>
        /// <returns></returns>
        private string GetFile()
        {
            string param = Request.Form["param"];

            if (string.IsNullOrEmpty(param))
            {
                return(ReturnString.JsonToString(Prompt.error, "打印未获取到参数", null));
            }

            string[] paramArr = param.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            if (paramArr.Length == 0)
            {
                return(ReturnString.JsonToString(Prompt.error, "访问参数错误", null));
            }
            else
            {
                EDRS.BLL.XY_DZJZ_XTPZ   bll   = new EDRS.BLL.XY_DZJZ_XTPZ(this.Request);
                EDRS.Model.XY_DZJZ_XTPZ model = bll.GetModel((int)EnumConfig.卷宗文件下载地址);
                if (model != null)
                {
                    IceServicePrx isp = new IceServicePrx();

                    string msg = "";

                    byte[] bytes = new byte[] { };

                    List <byte[]> pdflist = new List <byte[]>();

                    byte[] info = null;

                    string[] paramIds = null;


                    for (int i = 0; i < paramArr.Length; i++)
                    {
                        paramIds = paramArr[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        if (isp.DownFile(model.CONFIGVALUE, paramIds[0], paramIds[1], "", ref bytes, ref msg))
                        {
                            info = DataEncryption.Decryption(bytes);
                            pdflist.Add(info);
                        }
                        if (!string.IsNullOrEmpty(msg))
                        {
                            return(ReturnString.JsonToString(Prompt.error, StringPlus.String2Json(msg), null));
                        }
                    }
                    string fileName  = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    string fileParnt = string.Format("/PrintPdfFiles/{0}.pdf", fileName);
                    byte[] d         = MergePDFFiles(pdflist, fileParnt);
                    //Response.ContentType = "application/pdf";
                    //Response.AddHeader("content-disposition", "filename=pdf");
                    //Response.AddHeader("content-length", d.Length.ToString());
                    //Response.BinaryWrite(d);
                    return(ReturnString.JsonToString(Prompt.win, fileName, null));
                }
                else
                {
                    return(ReturnString.JsonToString(Prompt.error, "请先配置" + EnumConfig.卷宗文件下载地址, null));
                }
            }
        }