private void GetFile(int FileID)
        {
            MemoryStream ms = dal.OpenFilePDF(FileID, PublicClass.IsSingleClent);

            if (ms != null)
            {
                string fileName = Archives.DataAccess.DBPublic.getPath("pdf");

                FileStream   Fs = new FileStream(fileName, FileMode.Create);
                BinaryWriter Bw = new BinaryWriter(Fs);
                Bw.Write(ms.ToArray());

                Fs.Close();
                Bw.Close();

                if (System.IO.File.Exists(fileName))
                {
                    //UIPublicClass.PdfReader pdf = new UIPublicClass.PdfReader(fileName, true);
                    //pdf.Show();

                    //原foxitReader控件需向系统注册
                    //2019-06-28 替换为开源的pdf查看控件,不用向系统注册控件
                    UIPublicClass.PdfViewer viewer = new PdfViewer(fileName);
                    viewer.Show();
                }
            }
            else
            {
                MessageBox.Show("没有发现该案卷的电子案卷!");
            }
        }
        /// <summary>
        /// wcf服务端生成电子案卷
        /// 2019-07-07
        /// </summary>
        /// <param name="FileID"></param>
        private void GetFile2(int FileID)
        {
            Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            bool   isSuccess = false;
            string message   = "";

            UIPublicClass.WcfService.ElectronicFileInfo inValue = new UIPublicClass.WcfService.ElectronicFileInfo();
            inValue.Message      = message;
            inValue.id           = FileID;
            inValue.ArchivesType = DataBase.archivesType.GetHashCode();

            var service = GetServiceProxy();

            UIPublicClass.WcfService.DownFileResult retVal = service.DownLoadElectronicFile(inValue);
            isSuccess = retVal.IsSuccess;
            message   = retVal.Message;
            var stream   = retVal.FileStream;
            var filesize = retVal.FileSize;

            if (isSuccess)
            {
                string fileName = Archives.DataAccess.DBPublic.getPath("pdf");

                byte[]     buffer = new byte[filesize];
                FileStream fs     = new FileStream(fileName, FileMode.Create, FileAccess.Write);
                int        count  = 0;
                while ((count = stream.Read(buffer, 0, buffer.Length)) > 0)
                {
                    fs.Write(buffer, 0, count);
                }

                //清空缓冲区
                fs.Flush();
                //关闭流
                fs.Close();
                //MessageBox.Show("下载成功!");
                System.Threading.Thread.Sleep(100);

                if (System.IO.File.Exists(fileName))
                {
                    UIPublicClass.PdfViewer viewer = new PdfViewer(fileName);
                    viewer.Show();
                }
            }
            else
            {
                MessageBox.Show(message);
            }

            Cursor.Current = System.Windows.Forms.Cursors.Default;
        }
Esempio n. 3
0
        public static void ShowHelp_YJPLSM()
        {
            string pathname = System.Windows.Forms.Application.StartupPath + "\\Help\\原件批量扫描.pdf";

            if (System.IO.File.Exists(pathname))
            {
                //UIPublicClass.PdfReader pdf = new PdfReader(pathname, false);
                //pdf.IsHelpLook = true;
                //pdf.Show();

                UIPublicClass.PdfViewer viewer = new PdfViewer(pathname);
                viewer.Show();
            }
        }
Esempio n. 4
0
 private static void OpenLocalFile(string SaveFilePath, string Rename)
 {
     //先判断本地是否有此原件,如有就直接打开
     if (File.Exists(SaveFilePath + Rename))
     {
         try
         {
             string ext   = "";
             int    index = Rename.LastIndexOf('.');
             if (index >= 0)
             {
                 ext = Rename.Substring(index + 1);
             }
             if (ext == "pdf")
             {
                 //UIPublicClass.PdfReader pdf = new PdfReader(SaveFilePath + Rename, false);
                 //pdf.Show();
                 UIPublicClass.PdfViewer viewer = new PdfViewer(SaveFilePath + Rename);
                 viewer.Show();
             }
             else
             {
                 System.Diagnostics.Process.Start(SaveFilePath + Rename);
             }
         }
         catch
         {
             Image  img  = UIPublicClass.ImagePublic.暂无图片;
             string path = SaveFilePath + "temp.jpg";
             img.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
             if (File.Exists(path))
             {
                 System.Diagnostics.Process.Start(path);
             }
         }
     }
 }