Пример #1
0
        protected void btningresar_Click(object sender, EventArgs e)
        {
            bool        existe;
            string      id      = "";
            string      nombre  = "";
            string      cargo   = "";
            string      idcargo = "";
            PersonalDAO db      = new PersonalDAO();
            Accesos     ac      = new Accesos();

            ac.Usuario = txtuser.Text;
            ac.Clave   = txtpass.Text;
            existe     = db.Ingreso(ac, out id, out nombre, out idcargo, out cargo);
            if (existe)
            {
                Session["NombreUsuario"] = nombre;
                Session["IDUsuario"]     = id;
                Session["CargoUsuario"]  = cargo;
                if (idcargo == "3")
                {
                    Response.Redirect("~/Inicio.aspx", true);
                }
                else if (idcargo == "1")
                {
                    Response.Redirect("~/InicioVendedor.aspx", true);
                }
            }
            else
            {
                lblerror.Text    = "Usuario o contraseña incorrecto";
                lblerror.Visible = true;
                txtpass.Focus();
            }
        }