private bool generarPDFAceptacion(string nombre, string email
                                          , int codigoProyecto, string tipoArchivo
                                          , ref string archivoNotificacion)
        {
            bool generado = false;

            try
            {
                string OutPutDirectory       = ConfigurationManager.AppSettings.Get("RutaIP") + ConfigurationManager.AppSettings.Get("DirVirtual") + "Proyecto\\";
                var    customOutPutDirectory = OutPutDirectory + "Proyecto_" + codigoProyecto + "\\";

                dsAceptarTerminosCargaInformacion dsAceptarTerminosCarga = new dsAceptarTerminosCargaInformacion();

                dtCargaInfoRow dtCargaInfoRow = dsAceptarTerminosCarga.dtCargaInfo.NewdtCargaInfoRow();

                dtCargaInfoRow.EmailAcepta         = email;
                dtCargaInfoRow.FechaHoraAceptacion = DateTime.Now.ToString();
                dtCargaInfoRow.NombreAcepta        = nombre;
                dtCargaInfoRow.Mensaje             = "En mi calidad de Emprendedor beneficiario del " +
                                                     "Fondo Emprender, " +
                                                     "declaro bajo juramento y certifico con mi firma digitalizada, " +
                                                     "de manera libre y voluntaria que cada uno de los hechos, " +
                                                     "comentarios o precisiones sobre la ejecución del plan de negocios " +
                                                     "y los documentos de soporte presentados durante la visita de seguimiento virtual, " +
                                                     "en el marco del contrato suscrito con ENTerritorio y el SENA, " +
                                                     "se ajustan a la verdad, son ciertos y " +
                                                     "veraces frente a la realidad empresarial y mi actuar como empresario";

                dsAceptarTerminosCarga.dtCargaInfo.AdddtCargaInfoRow(dtCargaInfoRow);

                ReportDataSource reportDataCargaInfo = new ReportDataSource();
                reportDataCargaInfo.Value = dsAceptarTerminosCarga.dtCargaInfo;
                reportDataCargaInfo.Name  = "dsDatos";

                LocalReport report = new LocalReport();

                report.DataSources.Add(reportDataCargaInfo);

                report.ReportPath = @"PlanDeNegocioV2\Formulacion\Report\aceptarTerminosCargaInformacion.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 = customOutPutDirectory;
                    string strFileName = codigoProyecto + "-AceptaTerminos_" + tipoArchivo + ".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;
            }
            catch (Exception ex)
            {
                generado = false;
            }

            return(generado);
        }
Esempio n. 2
0
 public dtCargaInfoRowChangeEvent(dtCargaInfoRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }