Exemple #1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     RptNonLTO rpt = new RptNonLTO();
     rpt.Site = this.Site;
     return rpt;
 }
Exemple #2
0
        public ActionResult generateLTORPT(LTO listLTOObject, string ltoTypeParam)
        {
            List<LTO> ltoList = new List<LTO>();
            ltoList.Add(listLTOObject);

            var path = "";

            switch (ltoTypeParam)
            {
                case "0":
                    path = crpathLTO;
                    break;
                case "1":
                    path = crpathNONLTO;
                    break;
                default:
                    break;
            }

            if (ltoTypeParam == "0")
            {
                RptLTO rptH = new RptLTO();
                rptH.FileName = Server.MapPath(path);
                rptH.Load();
                rptH.SetDataSource(ltoList);
                rptH.SetParameterValue("encodedField", generateEncodedField());
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
            else if (ltoTypeParam == "1")
            {
                RptNonLTO rptNON = new RptNonLTO();
                rptNON.FileName = Server.MapPath(path);
                rptNON.Load();
                rptNON.SetDataSource(ltoList);
                rptNON.SetParameterValue("encodedField", generateEncodedField());
                Stream stream = rptNON.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
            else
            {
                return null;
            }
        }