示例#1
0
        public bool MD_PDF_JPG(string blh, string bglx, string bgxh, string ML, ZGQClass.type jpgpdf, ref string err_msg, ref string fileName, ref string fielPath, string IP, string useName, string pwd)
        {
            string   message = ""; string jpgname = "";
            ZGQClass zgq = new ZGQClass();

            bool isrtn = zgq.CreatePDF(blh, bglx, bgxh, jpgpdf, ref message, ref jpgname);

            string xy = f.ReadString("savetohis", "sctxfs", "1");

            if (isrtn)
            {
                bool ssa = false;
                if (useName.Trim() != "")
                {
                    //开共享
                    Process pro = new Process();

                    try
                    {
                        pro.StartInfo.FileName               = "cmd.exe";
                        pro.StartInfo.UseShellExecute        = false;
                        pro.StartInfo.RedirectStandardInput  = true;
                        pro.StartInfo.RedirectStandardOutput = true;
                        pro.StartInfo.RedirectStandardError  = true;
                        pro.StartInfo.CreateNoWindow         = true;
                        pro.Start();
                        pro.StandardInput.WriteLine("net use  \\\\" + IP + "\\ipc$ " + pwd + " /user:"******"");
                        Thread.Sleep(1000);

                        ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                    }
                    catch (Exception ee)
                    {
                        message = ee.Message;
                        ssa     = false;
                    }
                    finally
                    {
                        pro.StandardInput.WriteLine("net use  \\\\" + IP + "\\ipc$ /del");
                    }
                }
                else
                {
                    ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                }
                if (ssa == true)
                {
                    //jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                    fileName = jpgname;
                    fielPath = ML + "\\" + blh;
                    err_msg  = "";
                    zgq.DeleteTempFile(blh);
                    return(true);
                }
                else
                {
                    err_msg = message;
                    zgq.DeleteTempFile(blh);
                    return(false);
                }
            }
            else
            {
                zgq.DeleteTempFile(blh);
                err_msg = message;
                return(false);
            }
        }