コード例 #1
0
        public static bool DoReport(ReportObject reportObject, IPdfLauncher pdfLauncher)
        {
            bool reportOK = false;

            RunReport runReport = new RunReport();

            runReport.reportObject = reportObject;

            //runReport.reportObject = this;
            if (FileLogger.Instance.IsLogInfo)
            {
                FileLogger.Instance.logMessage(LogLevel.INFO, "ReportProcessing",
                                               "- Report " + reportObject.ReportTitle + " has been requested.");
            }

            if (runReport.CreateReport(pdfLauncher))
            {
                try
                {
                    //SMurphy 4/13/2010 problem when Adobe is already open
                    Process adbProcess = AdobeReaderOpen();
                    if (adbProcess != null)
                    {
                        adbProcess.Kill();
                    }
                }
                catch (Exception eX)
                {
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, "RunReport", "Exception thrown when killing Adobe processes: {0}:{1} {2}",
                                                       eX, eX.Data, eX.StackTrace ?? "NoStackTrace");
                    }
                }

                try
                {
                    pdfLauncher.ShowPDFFile(reportObject.ReportTempFileFullName, false);
                    reportOK = true;
                }
                catch (Exception /*exc*/)
                {
                    reportOK = false;
                }
            }

            return(reportOK);
        }
コード例 #2
0
        public static bool DoReport(LayawayReportObject reportObject, bool open, IPdfLauncher pdfLauncher)
        {
            bool reportOK = false;
            LayawayRunReports runReport = new LayawayRunReports();

            runReport.reportObject = reportObject;

            //runReport.reportObject = this;

            FileLogger.Instance.logMessage(LogLevel.INFO, "ReportProcessing", "- Report " + reportObject.ReportTitle + " has been requested.");

            if (runReport.CreateReport(pdfLauncher))
            {
                if (open)
                {
                    pdfLauncher.ShowPDFFile(reportObject.ReportTempFileFullName, false);
                }
            }

            return(reportOK);
        }