Example #1
0
        public ActionResult GenerarReporte(string id)
        {
            var alumno = alumnoBl.ObtenerAlumnoPorCodigoBL(id.ToString());

            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reporte"), "crReporteAlumno.rpt"));
            rd.SetParameterValue("@IdAlumno", id);
            rd.SetParameterValue("@IdCursoPosgrado", alumno.IdCursoPosgrado);
            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            rd.SetDatabaseLogon("sa", "F4br1c4*4t3", "13.59.152.82", "POST_PRUEBA");

            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            rd.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Reporte/alumno.pdf"));


            stream.Seek(0, SeekOrigin.Begin);
            return(File(stream, "application/pdf"));
        }