private bool generarPDFEnvioCorreoInforme(string ruta, long idCorreo, int codProyecto , ref string archivoNotificacion, ref string mensajeError) { bool generado = false; try { dsConfirmacionEnvioCorreo dsConfirmacionEnvio = new dsConfirmacionEnvioCorreo(); var datosCorreo = informesBLL.getCorreoInforme(idCorreo); dtInfoEnvioRow dtInfoRow = dsConfirmacionEnvio.dtInfoEnvio.NewdtInfoEnvioRow(); dtInfoRow.EmailRecibe = datosCorreo.emailRecibe; dtInfoRow.FechaHoraEnvio = datosCorreo.fechaHoraEnvio; dtInfoRow.Mensaje = datosCorreo.mensaje.Replace("<br />", System.Environment.NewLine); dtInfoRow.NombreEnvia = datosCorreo.nombreEnvia; dtInfoRow.NombreRecibe = datosCorreo.nombreRecibe; dsConfirmacionEnvio.dtInfoEnvio.AdddtInfoEnvioRow(dtInfoRow); ReportDataSource reportDataInfoEnvio = new ReportDataSource(); reportDataInfoEnvio.Value = dsConfirmacionEnvio.dtInfoEnvio; reportDataInfoEnvio.Name = "dsInfoEnvio"; LocalReport report = new LocalReport(); report.DataSources.Add(reportDataInfoEnvio); report.ReportPath = @"PlanDeNegocioV2\Administracion\Interventoria\InformeConsolidado\Report\confirmacionEnvioCorreo.rdlc"; byte[] fileBytes = report.Render("PDF"); if (fileBytes != null) { //Response.ContentType = "application/pdf"; //Response.AddHeader("content-disposition", fileBytes.Length.ToString()); //Response.BinaryWrite(fileBytes); string strFilePath = ruta; string strFileName = codProyecto + "-CorreoNotInformeConsolidado" + idCorreo + ".pdf"; string filename = Path.Combine(strFilePath, strFileName); using (FileStream fs = new FileStream(filename, FileMode.Create)) { fs.Write(fileBytes, 0, fileBytes.Length); } archivoNotificacion = strFileName; } generado = true; //MemoryStream ms = new MemoryStream(fileBytes, 0, 0, true, true); //Response.AddHeader("content-disposition", "attachment;filename= CorreoNotificacionInforme.pdf"); //Response.Buffer = true; //Response.Clear(); //Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length); //Response.OutputStream.Flush(); //Response.End(); } catch (Exception ex) { generado = false; mensajeError = "No se logró crear el pdf de notificacion: " + ex.Message; } return(generado); }
public dtInfoEnvioRowChangeEvent(dtInfoEnvioRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }