Example #1
0
        public void Initialize()
        {
            // this is where we instantiate the report printers. we pass in the writeable output path, and the associated report template.
            // maybe these should come from config, be shared with web?
            IndividualPrinter = new IndividualReportPrinter(Application.StartupPath + "\\FSTReport\\", Application.StartupPath + "\\Reports\\FSTResultReport.rdlc");
            BulkPrinter       = new BulkReportPrinter(Application.StartupPath + "\\FSTReport\\", Application.StartupPath + "\\Reports\\FSTReportTemplate.xlsx");

            // instantiating the threads.
            dequeuerThread   = new Thread(new ThreadStart(dequeueJobs));
            serviceThread    = new Thread(new ThreadStart(serviceHost));
            jobsReportThread = new Thread(new ThreadStart(jobsReportThreadMethod));
        }
Example #2
0
        /// <summary>
        /// This method writes the test results to a PDF using the IndividualReportPrinter class, and then writes the file as the response resulting in the client downloading the file.
        /// </summary>
        private void Print()
        {
            Response.Clear();
            Response.ContentType = "application/pdf";
            // this cookie is set to tell the spinner to disappear. on the page we generate a GUID in JS and set the txSpinningIndicatorGuid control to that alue
            // then we wait in a loop for the ComparisonDone cookie to come back with that value to make the indicator disappear.
            Response.AppendCookie(new HttpCookie("ComparisonDone", txSpinningIndicatorGuid.Text));
            Response.AddHeader("Content-Disposition", "attachment; filename=FSTReport.pdf");

            // this class prints a PDF to a file for us using ReportViewer and the ComparisonData.Print() method
            FST.Common.IndividualReportPrinter print = new IndividualReportPrinter(Server.MapPath("~/Admin/Upload/"), Server.MapPath("~/Reports/FSTResultReport.rdlc"));
            string filepath = print.Print(comparisonData);

            // we write the file to the Response stream
            Response.BinaryWrite(File.ReadAllBytes(filepath));
            Response.End();
            // delete the file and log if there's an error
            try { File.Delete(filepath); }
            catch { Log.Error(Context.User.Identity.Name, Request.FilePath, Session, "Temporary Report File Deletion Error", filepath, null); }
        }