Example #1
0
        private void LlenarEmpleados()
        {
            var Lista = EmpleadoLN.getInstance().ListarEmpleados();

            ddlEmpleado.DataSource     = Lista;
            ddlEmpleado.DataValueField = "Rut";
            ddlEmpleado.DataTextField  = "Nombre";
            ddlEmpleado.DataBind();
            ddlEmpleado.Items.Insert(0, new ListItem(" Luego un empleado", "0"));
        }
        public override bool ValidateUser(string username, string password)
        {
            bool     ok          = false;
            Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(username, password);

            if (objEmpleado != null)
            {
                ok = true;
            }
            return(ok);
        }
Example #3
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            Emplead objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsuario.Text, txtPassword.Text);

            if (objEmpleado != null)
            {
                Response.Write("<script>alert('USUARIO CORRECTO .')</script>");
            }
            else
            {
                Response.Write("<script>alert('USUARIO inCORRECTO .')</script>");
            }
        }
        protected void btnEntrar_Click(object sender, EventArgs e)
        {
            Empleado objEmpleado = EmpleadoLN.getInstance().AcessoSistema(txtUsuario.Text, txtPassword.Text);

            if (objEmpleado != null)
            {
                Response.Write("<script>alert('USUARIO CORRETO.')</script>");
                Response.Redirect("PainelGeral.aspx");
            }
            else
            {
                Response.Write("<script>alert('USUARIO INCORRETO.')</script>");
            }
        }
Example #5
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            var Empleado = EmpleadoLN.getInstance().getAccess(txtUsuario.Text, txtPassword.Text);

            if (Empleado != null)
            {
                Response.Write("<script>alert('Usuario Correcto') </script>");
                Response.Redirect("PanelGeneral.aspx");
            }
            else
            {
                Response.Write("<script>alert('Usuario Incorrecto') </script>");
            }
        }
Example #6
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            // Ya tengo los datos que corresponden para el login
            Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsuario.Text, txtPassword.Text);

            if (objEmpleado != null)
            {
                // significa que si ha accedido a la base de datos y que a su vez ha traido un objeto
                Response.Write("<script>alert('USUARIO CORRECTO.')</script>");
                Response.Redirect("PanelGeneral.aspx");
            }
            else
            {
                Response.Write("<script>alert('USUARIO INCORRECTO.')</script>");
            }
        }
Example #7
0
        //protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        //{
        //    bool auth = Membership.ValidateUser(LoginUser.UserName, LoginUser.Password);

        //    if (auth)
        //    {
        //        Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(LoginUser.UserName, LoginUser.Password);

        //    if (objEmpleado != null)
        //    {
        //        SessionManager = new SessionManager(Session);
        //        SessionManager.UserSession = objEmpleado.Usuario.ToString();

        //        FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false);
        //        //Response.Write("<script>alert('USUARIO CORRECTO')</script>");
        //        //Response.Redirect("PanelGeneral.aspx");
        //    }
        //    else
        //    {
        //        Response.Write("<script>alert('USUARIO INCORRECTO')</script>");
        //    }
        //    }
        //}

        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(txtUsername.Text, txtPassword.Text);

            if (objEmpleado != null)
            {
                //SessionManager = new SessionManager(Session);
                //SessionManager.UserSessionObjeto = objEmpleado;
                Session["UserSistemaWeb"] = objEmpleado.Usuario.ToString();
                Response.Redirect("~/PanelGeneral.aspx");
            }
            else
            {
                lblMensajeError.Text = "Usuario y/o Contraseña Incorrecto";
            }
        }
Example #8
0
    protected void btnIngresar_Click(object sender, EventArgs e)
    {
        // string user = txtusuario.Text;
        // string password = txtPassword.Text;
        // string userName = "******";
        // string passName = "4ug02000";
        //
        // if (user.Equals(userName) && password.Equals(passName))
        Empleado objEmpleado = EmpleadoLN.getInstance().AccesoDatos(txtusuario.Text, txtPassword.Text);

        if (objEmpleado != null)
        {
            Response.Write("<script> alert ('Usuario Correcto'); </script>");
        }
        else
        {
            Response.Write("<script> alert ('Usuario Incorrecto'); </script>");
        }
    }
        protected void LoginUser_Aunthenticate(object sender, AuthenticateEventArgs e)
        {
            bool auth = Membership.ValidateUser(LoginUser.UserName, LoginUser.Password);

            if (auth)
            {
                Empleado objEmpleado = EmpleadoLN.getInstance().AccesoSistema(LoginUser.UserName, LoginUser.Password);

                if (objEmpleado != null)
                {
                    SessionManager _SessionManager = new SessionManager(Session);
                    //SessionManager.UserSessionId = objEmpleado.ID.ToString();
                    _SessionManager.UserSessionEmpleado = objEmpleado;
                    FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false);
                }
                else
                {
                    Response.Write("<script>alert('USUARIO INCORRECTO.')</script>");
                }
            }
        }
Example #10
0
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            if (!Regex.IsMatch(txtDNI.Text, "[^0-9]") && txtDNI.Text.Length != 8)
            {
                hfIdEmpleado.Value = "0";
                ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('INGRESAR NÚMERO DE DOCUMENTO VÁLIDO')", true);
                return;
            }

            if (txtDNI.Text.Length == 8)
            {
                Empleado objEmpleado = EmpleadoLN.getInstance().BuscarEmpleado(txtDNI.Text);

                if (objEmpleado != null)
                {
                    if (objEmpleado.ID != 0)
                    {
                        hfIdEmpleado.Value = objEmpleado.ID.ToString();
                        ListarPermisosAsignados(objEmpleado.ID, 0);   // 0 es para asignados
                        ListarPermisosNoAsignados(objEmpleado.ID, 1); // 1 es para no asignados
                    }
                    else
                    {
                        hfIdEmpleado.Value = "0";
                        ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO')", true);
                        //Response.Write("<script>alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO.')</script>");
                    }
                }
                else
                {
                    hfIdEmpleado.Value = "0";
                    ScriptManager.RegisterStartupScript(this, GetType(), "alerta", "alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO')", true);
                    //Response.Write("<script>alert('NO EXISTE EMPLEADO CON EL DOCUMENTO INGRESADO.')</script>");
                }
            }
            else
            {
                hfIdEmpleado.Value = "0";
            }
        }