Beispiel #1
0
        private bool enviarCorreo(SharePointComportamientoEmprendedor comportamientoEmprendedor)
        {
            bool enviado = false;

            try
            {
                string mensajeEnviar = MensajeComportamientoEmprendedor(comportamientoEmprendedor);
                string paraEmail     = ConfigurationManager.AppSettings.Get("EmailComportamientoEmprendedor");

                CorreoAdvanced correo = new CorreoAdvanced(""
                                                           , "Descarga de archivo comportamiento emprendedor"
                                                           , paraEmail
                                                           , "William Daza"
                                                           , "Descarga de archivo comportamiento emprendedor"
                                                           , mensajeEnviar);
                string mensaje = correo.Enviar();
                if (mensaje != "OK")
                {
                    enviado = false;
                }
                else
                {
                    enviado = true;
                }
            }
            catch (Exception e)
            {
                enviado = false;
            }

            return(enviado);
        }
Beispiel #2
0
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (validarCampos())
            {
                string valor = Convert.ToString(Request.QueryString["doc"]);

                string modulo = valor.Split('.')[0];
                string unidad = valor.Split('.')[1];

                valor = valor.Replace(".", string.Empty);

                using (RegistroUnicoDataContext db = new RegistroUnicoDataContext(conexion))
                {
                    SharePointComportamientoEmprendedor comportamientoEmprendedor = new SharePointComportamientoEmprendedor()
                    {
                        Nombres            = txtNombres.Text,
                        Apellidos          = txtApellidos.Text,
                        TipoIdentificacion = cmbTipoIdentificacion.SelectedItem.Text,
                        Identificacion     = txtIdentificacion.Text,
                        Telefono           = Convert.ToInt64(txtTelefono.Text),
                        Email                              = txtCorreo.Text,
                        codCiudad                          = Convert.ToInt32(CodCiudadExpedicion.Text),
                        Modulo                             = modulo,
                        Unidad                             = unidad,
                        RutaArchivoDescargado              = rutaArchivo(valor),
                        emailEnviado                       = false,
                        archivoDescargado                  = false,
                        ParticiparCharlasHablemosDe        = cmbParticiparCharlas.Value,
                        fechaIngreso                       = DateTime.Now,
                        ServicioOrientacion                = chkOrientacion.Checked,
                        ServicioAsesoriaCreacionEmpresa    = chkAsesoriaCreacionEmpresa.Checked,
                        ServicioAsesoriaFormulacionPlan    = chkAsesoriaFormulacionPlan.Checked,
                        ServicioFortalecimientoEmpresarial = chkFortalecimientoEmpresarial.Checked
                    };

                    db.SharePointComportamientoEmprendedor.InsertOnSubmit(comportamientoEmprendedor);
                    db.SubmitChanges();

                    //Descargar Archivo
                    comportamientoEmprendedor.archivoDescargado = descargarArchivo(comportamientoEmprendedor.RutaArchivoDescargado);

                    //Enviar correo y confirmar envio
                    comportamientoEmprendedor.emailEnviado = enviarCorreo(comportamientoEmprendedor);

                    db.SubmitChanges();
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script>javascript: alert('Por favor diligencie el formulario correctamente.');</script>");
            }
        }
Beispiel #3
0
        private string MensajeComportamientoEmprendedor(SharePointComportamientoEmprendedor emprendedor)
        {
            string mensaje = "Se ha registrado una nueva descarga de archivo para comportamiento emprendedor."
                             + "<br />" + "<br />"
                             + "Nombre: " + emprendedor.Nombres + "<br />"
                             + "Apellido: " + emprendedor.Apellidos + "<br />"
                             + emprendedor.TipoIdentificacion + ": " + emprendedor.Identificacion + "<br />"
                             + "Telefono: " + emprendedor.Telefono + "<br />"
                             + "Email: " + emprendedor.Email + "<br />"
                             + "Ciudad: " + getCiudad(emprendedor.codCiudad) + "<br />"
                             + "Departamento: " + getDepartamento(emprendedor.codCiudad) + "<br />"
                             + "Archivo: " + emprendedor.Unidad + "<br />"
                             + "Fecha Registro: " + emprendedor.fechaIngreso + "<br />"
                             + "¿Le gustaría participar de las Charlas \"Hablemos de\"? : " + emprendedor.ParticiparCharlasHablemosDe + "<br />"
                             + "¿A cuál(es) de los servicios de emprendimiento del SENA le gustaría acceder?: " + "<br />"
                             + "- Orientación: " + (emprendedor.ServicioOrientacion.GetValueOrDefault(false) ? "SI" : "NO") + "<br />"
                             + "- Asesoría para la creación de empresa: " + (emprendedor.ServicioAsesoriaCreacionEmpresa.GetValueOrDefault(false) ? "SI" : "NO") + "<br />"
                             + "- Asesoría para la formulación del plan de negocios a Convocatorias Fondo Emprender: " + (emprendedor.ServicioAsesoriaFormulacionPlan.GetValueOrDefault(false) ? "SI" : "NO") + "<br />"
                             + "- Fortalecimiento empresarial: " + (emprendedor.ServicioFortalecimientoEmpresarial.GetValueOrDefault(false) ? "SI" : "NO") + "<br />"
            ;

            return(mensaje);
        }