Ejemplo n.º 1
0
        public bool IsValidLogin(string employeeNo, string password)
        {
            try
            {
                List <tbm_Employee> user = base.GetEmployeeByEmpNo(employeeNo);
                if (user.Count < 1)
                {
                    return(false);
                }

                tbm_Employee    loginUser = user.First();
                PasswordHandler handle    = new PasswordHandler();
                if (loginUser.Status == PasswordHandler.STATUS_ACCOUNT_LOCK)
                {
                    return(false);
                }

                if (loginUser.Password == handle.GeneratePasswordHash(password))
                {
                    handle.PasswordWrongCountReset(loginUser.EmpNo);
                    return(true);
                }
                else
                {
                    handle.PasswordWrongCountUp(loginUser.EmpNo);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }