protected void BtnInicioRegistro_Click(object sender, EventArgs e)
        {
            string nit, fechaNacimiento, nombres, apellidos, email, perfil;

            nit             = TxtNIT.Text;
            fechaNacimiento = TxtFechaNacimiento.Text;
            nombres         = TxtNombres.Text;
            apellidos       = TxtApellidos.Text;
            email           = TxtEmail.Text;
            perfil          = CboTipoAspitante.SelectedValue;
            const string chars    = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./$";
            var          random   = new Random();
            string       password = new string(Enumerable.Repeat(chars, 10)
                                               .Select(s => s[random.Next(s.Length)]).ToArray());
            bool Sigue = VerificarUsuario(nit, fechaNacimiento, Convert.ToInt32(perfil));

            // Si sigue=true se procesa el ingreso
            if (Sigue == true)
            {
                CUsuario objUsuario = new CUsuario(_DataSistema.ConexionBaseDato);

                try
                {
                    objResultado = objUsuario.Actualizacion(nit.Replace("-", ""), nombres + " " + apellidos, password, perfil,
                                                            email, 'A', nit, TipoActualizacion.Adicionar);

                    if (objResultado.CodigoError == 0)
                    {
                        CAspirante objAspirante = new CAspirante(_DataSistema.ConexionBaseDato);
                        objResultado = objAspirante.Actualizacion(nit, nombres, apellidos, Convert.ToDateTime(fechaNacimiento), 'X',
                                                                  "", "", "", email, "", nit, 'P', Convert.ToInt32(perfil), "", 0, 0, 0, nit, "", "", "", nit,
                                                                  TipoActualizacion.Adicionar);
                        CConfMail objConfMail = new CConfMail(_DataSistema.ConexionBaseDato);
                        DataView  dvConfMail = new DataView(objConfMail.Detalle(1, "", "", "", 0, "", "", "", DateTime.Now, "", DateTime.Now, 1).TBC_CONF_MAIL);
                        string    asunto, body, correo;
                        asunto = "Registro Usuario PIXELS CAPS";
                        body   = "<h3 align='center'>Registrado a PIXELS CAPS</h3><br><label>Usuario:" + nit.Replace("-", "") + "</label><br><label>Contraseña:" + password + "</label>";
                        correo = email;
                        objConfMail.SendMail(dvConfMail.Table.Rows[0]["DS_MAIL_FROM"].ToString(), dvConfMail.Table.Rows[0]["DS_MAIL_HEAD"].ToString(), dvConfMail.Table.Rows[0]["DS_SMTP"].ToString(),
                                             Convert.ToInt32(dvConfMail.Table.Rows[0]["DS_PORT"].ToString()), dvConfMail.Table.Rows[0]["DS_MAIL"].ToString(), dvConfMail.Table.Rows[0]["DS_PASSWORD"].ToString(),
                                             asunto, body, correo);
                        DespliegaMensaje("Usuario y Contraseña enviado al correo");
                        LimpiarFormulario();
                    }
                    else
                    {
                        DespliegaMensaje(objResultado.MensajeError.Replace("'", ""));
                    }
                }
                catch (Exception ex)
                {
                    DespliegaMensaje(ex.Message);
                }
            }
            else
            {
                DespliegaMensaje("Usuario ya existe o no cumple rango de edades");
            }
        }
Beispiel #2
0
        protected void BtnEnviarCorreo_Click(object sender, EventArgs e)
        {
            CConfMail objConfMail = new CConfMail(_DataSistema.ConexionBaseDato);
            DataView  dvConfMail = new DataView(objConfMail.Detalle(1, "", "", "", 0, "", "", "", DateTime.Now, "", DateTime.Now, 1).TBC_CONF_MAIL);
            string    asunto, body, correo;

            asunto = "NOTIFICACION DE PROYECTO DICA";
            body   = "<H3 align='center'>NOTIFICACION DE PROYECTO DICA</H3>" + "<p>Estimado usuario <b>" + TxtContacto.Text + "</b> de la Empresa <b>" + TxtNombreEmpresa1.Text +
                     "</b> se le informa que presenta un atraso en: </p>" + "<p>Nombre Proyecto: <b>" + TxtConsultoria.Text + "</b></p>" +
                     "<p>Nombre de Entregable: <b>" + TxtEntregable.Text + "</b></p>" + "<p>Estado de Entregable: <b>" + TxtAdvertencia.Text + "</b></p>" +
                     "<p>Por lo cual, comuníquese con el responsable de su consultoria, para que esta situación sea solventada a la brevedad posible.</p><br>" +
                     "<p>IMPORTANTE:<p><p>Este correo es informativo, favor no responder a esta dirección de correo, ya que no se encuentra habilitada para recibir mensajes.</p> ";
            correo = TxtEmailCon.Text;
            objConfMail.SendMail(dvConfMail.Table.Rows[0]["DS_MAIL_FROM"].ToString(), dvConfMail.Table.Rows[0]["DS_MAIL_HEAD"].ToString(), dvConfMail.Table.Rows[0]["DS_SMTP"].ToString(),
                                 Convert.ToInt32(dvConfMail.Table.Rows[0]["DS_PORT"].ToString()), dvConfMail.Table.Rows[0]["DS_MAIL"].ToString(), dvConfMail.Table.Rows[0]["DS_PASSWORD"].ToString(),
                                 asunto, body, correo);
            DespliegaMensaje("Se ha enviado correo satisfactoriamente");
        }