Esempio n. 1
0
        /// <summary>
        /// Check Username + Password in employee list
        /// </summary>
        /// <param name="model">Login Model store data</param>
        /// <returns>Result: true if successfully</returns>
        protected bool CheckLogin(LoginModel model)
        {
            string          passwordEncrypted = StringCipher.GetMd5Hash(model.AuthorizationCode);
            EmployeeInfoDAL employeeInfoDAL   = new EmployeeInfoDAL(SPContext.Current.Web.Url);
            var             employeeInfo      = employeeInfoDAL.GetByEmployeeID(model.EmployeeID);

            //Bug #18 - Tong_Hop_Bosch_11_01_2018 date: 12-01-2018 - Fixed by TRC81HC - Check if login user is common user
            var result = employeeInfo != null && employeeInfo.Password == passwordEncrypted && employeeInfo.EmployeeType == StringConstant.EmployeeType.CommonUser;

            if (result)
            {
                UserPermission.SetEmployeeInfo(employeeInfo);
            }
            else
            {
                UserPermission.SetEmployeeInfo(null);
            }
            return(result);
        }