public void GetRadiographyInspectionDetailsPDF(int ProjId, string NDE_Rep_No)
        {
            Random random   = new Random();
            int    fileId   = random.Next(1000, 9999);
            string fileName = $"report_{fileId}.pdf";
            string filePath = $@"C:\Temp\{fileName}";

            RadiographyInspectionReport report = new RadiographyInspectionReport();

            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
            report.ReportParameters["ProjId"].Value        = ProjId;
            report.ReportParameters["NDE_Report_No"].Value = NDE_Rep_No;

            Telerik.Reporting.Processing.RenderingResult renderingResult = reportProcessor.RenderReport("PDF", report, null);

            FileStream fs = new FileStream(filePath, FileMode.Create);

            fs.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length);
            fs.Close();

            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("Content-Disposition", $"attachment;filename={fileName}");
            HttpContext.Current.Response.TransmitFile(filePath);
            HttpContext.Current.Response.End();
        }
Beispiel #2
0
        protected void btnReport_Click(object sender, EventArgs e)
        {
            int ProjId = Convert.ToInt32(Session["ProjId"]);
            //ReportViewer1.Visible = true;
            RadiographyInspectionReport report = new RadiographyInspectionReport();

            report.ReportParameters[0].Value = ProjId;
            report.ReportParameters[1].Value = rt_NDE_ReportNo.Value;
            ReportViewer1.ReportSource       = report;
        }