示例#1
0
        public static string FileConsult(string predelcode)
        {
            DataTable dt   = Declare.FileConsult(predelcode);
            string    json = "";

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string downfile = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPdf\" + dr["declcode"] + ".pdf";
                    bool   bf       = true;
                    if (!File.Exists(downfile))
                    {
                        //PDF获取文件
                        System.Uri Uri      = new Uri("ftp://" + ConfigurationManager.AppSettings["FTPServer"] + ":" + ConfigurationManager.AppSettings["FTPPortNO"]);
                        string     UserName = ConfigurationManager.AppSettings["FTPUserName"];
                        string     Password = ConfigurationManager.AppSettings["FTPPassword"];
                        FtpHelper  ftp      = new FtpHelper(Uri, UserName, Password);
                        bf = ftp.DownloadFile("/" + dr["filename"].ToString2() + "", downfile);
                    }
                    if (bf)
                    {
                        //pdf转picture
                        string picPath = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPic\";
                        json = ConvertPDF.pdfToPic(downfile, picPath, dr["declcode"].ToString2());
                    }
                }
            }
            return(json);
        }
示例#2
0
        public static string GetDeclPdf(string orderCode)
        {
            ListOrderModel orderModel = new ListOrderModel();
            DataTable      dt         = orderModel.getDeclPath(orderCode);
            string         json       = "";

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string output = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPdf\" + dr["declcode"] + ".pdf";
                    bool   bf     = true;
                    if (!File.Exists(output))
                    {
                        //PDF获取文件
                        System.Uri Uri      = new Uri("ftp://" + ConfigurationManager.AppSettings["FTPServer"] + ":" + ConfigurationManager.AppSettings["FTPPortNO"]);
                        string     UserName = ConfigurationManager.AppSettings["FTPUserName"];
                        string     Password = ConfigurationManager.AppSettings["FTPPassword"];
                        FtpHelper  ftp      = new FtpHelper(Uri, UserName, Password);
                        bf = ftp.DownloadFile("/" + dr["filename"].ToString2() + "", output);
                    }
                    if (bf)
                    {
                        //pdf转picture
                        string picPath = HttpRuntime.AppDomainAppPath + @"\TempFile\tempPic\";
                        json += ConvertPDF.pdfToPic(output, picPath, dr["declcode"].ToString2());
                    }
                }
            }
            return(json);
        }