private void RenderReport_jurados() { Reportes.reporte_jurado ds = Session["ds_jurados"] as Reportes.reporte_jurado; ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.EnableExternalImages = true; viewer.LocalReport.ReportPath = Server.MapPath("~/Aplicativo/Reportes/reporte_jurado.rdlc"); ReportDataSource detalle = new ReportDataSource("t_jurado", ds.t_jurado.Rows); viewer.LocalReport.DataSources.Add(detalle); Microsoft.Reporting.WebForms.Warning[] warnings = null; string[] streamids = null; string mimeType = null; string encoding = null; string extension = null; string deviceInfo = null; byte[] bytes = null; deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"; //Render the report bytes = viewer.LocalReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); Session["Reporte"] = bytes; string script = "<script type='text/javascript'>window.open('Reportes/reportes.aspx');</script>"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "VentanaPadre", script); }
protected void btn_imprimir_certificado_jurados_Click(object sender, EventArgs e) { int id_mesa = Convert.ToInt32(((Button)sender).CommandArgument); bool mesa_cerrada = false; using (HabProfDBContainer cxt = new HabProfDBContainer()) { Mesa mesa = cxt.Mesas.FirstOrDefault(pp => pp.mesa_id == id_mesa); if (mesa.mesa_estado == "Cerrada") { Reportes.reporte_jurado ds = new Reportes.reporte_jurado(); foreach (Jurado jurado in mesa.Jueces) { foreach (Tesina tesina in mesa.Tesinas) { Reportes.reporte_jurado.t_juradoRow jr = ds.t_jurado.Newt_juradoRow(); jr.jurado_id = jurado.juez_id; jr.jurado_dni = jurado.Persona.persona_dni.ToString(); jr.jurado_licenciatura_nombre = jurado.Persona.Licenciatura.licenciatura_nombre; jr.jurado_mesa_fecha = mesa.mesa_fecha.ToShortDateString(); jr.jurado_nombre = jurado.Persona.persona_nomyap; jr.jurado_tesina_tema = tesina.tesina_tema; jr.jurado_tesina_tesista = tesina.Tesista.Persona.persona_nomyap; ds.t_jurado.Rows.Add(jr); } } mesa_cerrada = true; Session["ds_jurados"] = ds; } } if (mesa_cerrada) { RenderReport_jurados(); } else { MessageBox.Show(this, "No se pueden imprimir los certificados mientras la mesa no este cerrada.", MessageBox.Tipo_MessageBox.Warning); } }