コード例 #1
0
        public DatAbstracta()
        {
            conn = new SqlConnection(UtiCrypto.DesEncriptar("poubbDovFVgmY7x+1hBEfUshzh8KWs1EQCt2e+pwRk5aQatiYfz/M5i4T7sTFTsQOWsBVscFbUrZsF71IWD6pFlKSg8ktNOgKfezFqVM9yI="));

            ///Establecer la conexion desde la web config con el ConfigurationManager y agregamos la referencia desde datAnimales, pestañas ensamblado, elegir system.configuration y depues resolver            //conn = new SqlConnection();
            //conn.ConnectionString = ConfigurationManager.ConnectionStrings["NombreConexion"].ToString();
        }
コード例 #2
0
ファイル: Editar.aspx.cs プロジェクト: joragui2003/KadmielGit
 protected void btnCambiarP_Click(object sender, EventArgs e)
 {
     try
     {
         EntCliente ent      = (EntCliente)Session["123"];
         string     passEncr = UtiCrypto.Encriptar(txtPasswordActual.Text);
         if (ent.Password == passEncr)
         {
             EntCliente cli = new EntCliente();
             cli.Id       = Convert.ToInt32(hfIdCliente.Value);
             cli.Password = UtiCrypto.Encriptar(txtPasswordNuevo.Text);
             new BusCliente().ActualizarPass(cli);
             hfPassNvo.Value = cli.Password;
             this.programmaticModalPopup.Show();
         }
         else
         {
             throw new ApplicationException("Contraseña Actual inválida");
         }
     }
     catch (Exception ex)
     {
         MostrarMensaje(ex.Message);
     }
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="direccionAQuienSeManda"></param>
        /// <param name="tituloCorreo"></param>
        /// <param name="cuerpoCorreo"></param>
        public void MandarCorreo(string direccionAQuienSeManda, string tituloCorreo, string cuerpoCorreo)
        {
            try
            {
                MailMessage mensaje = new MailMessage();

                string direccionQuienManda = ConfigurationManager.AppSettings["direccionQuienManda"];

                mensaje.From = new MailAddress(direccionQuienManda); //Aquí puede ir cualquier correo electrónico
                mensaje.To.Add(new MailAddress(direccionAQuienSeManda));
                mensaje.Subject = tituloCorreo;
                mensaje.Body    = cuerpoCorreo;
                //Attachment at = new Attachment("Imagenes/espera_hotmail2.gif");
                //mensaje.Attachments.Add(at);

                mensaje.Priority = MailPriority.Normal;
                SmtpClient smtl = new SmtpClient();
                smtl.Host = UtiCrypto.DesEncriptar(ConfigurationManager.AppSettings["smtp.Host"]);                  //"mail.tag-tic.com.mx";
                smtl.Port = Convert.ToInt32(UtiCrypto.DesEncriptar(ConfigurationManager.AppSettings["smtp.Port"])); //26;
                string usuario    = ConfigurationManager.AppSettings["usuario"];
                string contraseña = ConfigurationManager.AppSettings["contraseña"];
                smtl.Credentials = new System.Net.NetworkCredential(UtiCrypto.DesEncriptar(usuario), UtiCrypto.DesEncriptar(contraseña));   //new System.Net.NetworkCredential("*****@*****.**", "fill");
                smtl.Send(mensaje);
            }
            catch (Exception ex)
            {
                ApplicationException a = new ApplicationException("No se mando el correo electrónico", ex);
                a.Data.Add("1", "DejarPasar");
                //throw a;
            }
        }
コード例 #4
0
 protected void btnEnviarPass_Click(object sender, EventArgs e)
 {
     try
     {
         EntCliente cli = new BusCliente().Obtener(txtPass.Text);
         lblCorreo.Text = cli.Email;
         string pass = UtiCrypto.DesEncriptar(cli.Password);
         UtiCorreo.MandarCorreo(cli.Email, "Recuperación de Contraseña", "Haz solicitado recuperar tu contraseña, \n Tu contraseña es:  " + pass + " \n\nRecuerda que puedes editar tus datos dentro de \"Mis Autos\" \n www.verificentrosdehidalgo.com");
         this.programmaticModalPopup.Show();
     }
     catch (Exception ex)
     {
         MostrarMensaje(ex.Message);
     }
 }
コード例 #5
0
 protected void btnEntrar_Click1(object sender, EventArgs e)
 {
     try
     {
         EntCliente ent = new EntCliente();
         ent.Usuario  = txtUser.Text;
         ent.Password = UtiCrypto.Encriptar(txtPass.Text);
         EntCliente log = new BusCliente().Obtener(ent.Usuario, ent.Password);
         if (log == null)
         {
             throw new ApplicationException("Usuario y/o Contraseña incorrecta");
         }
         Session["123"] = log;
         Response.Redirect("~/Pages/Autos.aspx");
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "alert('" + ex.Message + "');", true);
     }
 }
コード例 #6
0
 protected void btnEntrar_Click1(object sender, EventArgs e)
 {
     try
     {
         EntCliente ent = new EntCliente();
         ent.Email    = txtMailEnt.Text;
         ent.Password = UtiCrypto.Encriptar(txtPass.Text);
         EntCliente log = new BusCliente().Obtener(ent.Email, ent.Password);
         if (log == null)
         {
             throw new ApplicationException("Correo electrónico y/o Contraseña incorrecta");
         }
         log.Estatus = true;
         new BusCliente().ActualizarEsta(log);
         Session["123"] = log;
         Response.Redirect("Autos.aspx");
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "error", "alert('" + ex.Message + "');", true);
     }
 }
コード例 #7
0
 protected void btnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         EntCliente cli = new EntCliente();
         cli.Nombre   = txtNombre.Text;
         cli.Paterno  = txtPaterno.Text;
         cli.Materno  = txtMaterno.Text;
         cli.Email    = txtCorreo.Text;
         cli.Telefono = txtTelefono.Text;
         cli.Empresa  = txtEmpresa.Text;
         cli.Usuario  = txtUsuario.Text;
         string pass = UtiCrypto.Encriptar(txtPassword.Text);
         cli.Password  = pass;
         cli.FechaNaci = Convert.ToDateTime(txtFechNaci.Text);
         new BusCliente().Insertar(cli);
         Response.Redirect(Request.CurrentExecutionFilePath);
     }
     catch (Exception ex)
     {
         MostrarMensaje(ex.Message);
     }
 }
コード例 #8
0
    protected void btnAgregar_Click(object sender, EventArgs e)
    {
        try
        {
            EntCliente cli = new EntCliente();
            cli.Nombre   = "";
            cli.Paterno  = "";
            cli.Materno  = "";
            cli.Email    = txtCorreo.Text;
            cli.Telefono = "";
            cli.Empresa  = "";
            cli.Usuario  = "";
            string pass = UtiCrypto.Encriptar(txtPassword.Text);
            cli.Password  = pass;
            cli.FechaNaci = Convert.ToDateTime("01/01/1990");
            //int mayor = CalculateAge.Calcular(Convert.ToDateTime(txtFechNaci.Text));
            //if (mayor >= 18)
            //    cli.FechaNaci = Convert.ToDateTime(txtFechNaci.Text);
            //else
            //    throw new ApplicationException("Debe de ser mayor de edad");
            if (!chkAviso.Checked)
            {
                throw new ApplicationException("Se deben de aceptar los términos y condiciones para registrarse!!!");
            }

            new BusCliente().Insertar(cli);
            string asunto = "Confirmación de Alta";
            string cuerpo = "Gracias por registrarte " + cli.Email + ", ahora agrega tus vehículos en el menú Mis Autos. \n www.verificentrosdehidalgo.com/Autos.aspx";
            UtiCorreo.MandarCorreo(cli.Email, asunto, cuerpo);
            UtiCorreo.MandarCorreo("*****@*****.**", "Alta de Usuario", "Se agregó un nuevo cliente a tu página web: " + cli.Email);
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            MostrarMensaje(ex.Message);
        }
    }
コード例 #9
0
 public DatPaciente()
 {
     con = new SqlConnection();
     con.ConnectionString = UtiCrypto.DesEncriptar(ConfigurationManager.ConnectionStrings["RegistroPacientes"].ConnectionString);
 }