コード例 #1
0
        public static dynamic SelectByNameAndPassword(string LoginName, string Password, string CompanyId, string BranchNo)
        {
            int           result = 0;
            List <string> roles  = new List <string>();

            roles.Add("Admin");
            CustomUserAuthorizeController auth = new CustomUserAuthorizeController();
            int value = auth.validate(roles);

            if (value == (int)UserStatusEnum.UserStatus.Authorized)
            {
                Hr_Users obj = UsersBL.GetObject().SelectByNameAndPassword(LoginName, Password, CompanyId, BranchNo);
                if (obj != null && obj.UserId != null)
                {
                    result = 1;
                    HttpContext.Current.Session["Hr_UserDL"] = obj;
                }
                else
                {
                    result = 0;
                }
            }

            return(result);
            // return Ok(result);
        }