Example #1
0
        /// <summary>
        /// 系统登录
        /// </summary>
        /// <param name="account"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool Login(string account, string password)
        {
            var accountInfo = _accountInfoRepository.GetLoginAccount(account, password);

            if (accountInfo != null)
            {
                //存储Session
                UserStorage.Instance.AccountId  = accountInfo.Id;                    //把用户id保存到session中
                UserStorage.Instance.EmployeeId = accountInfo.EmployeeId;            //把用户员工id保存到session中
                //var employeeInfo = _employeeInfoRepository.GetById(accountInfo.EmployeeId);
                UserStorage.Instance.Authority = accountInfo.EmployeeInfo.Authority; //把用户权限等级保存到session中
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// 系统登录
        /// </summary>
        /// <param name="account"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool Login(string account, string password)
        {
            var accountInfo = _accountInfoRepository.GetLoginAccount(account, password);

            if (accountInfo != null)
            {
                //存储Session
                var _session = HttpContext.Current.Session;
                _session["AccountId"]  = accountInfo.Id.ToString();             //把用户id保存到session中
                _session["EmployeeId"] = accountInfo.EmployeeId.ToString();     //把用户员工id保存到session中
                var employeeInfo = _employeeInfoRepository.GetById(accountInfo.EmployeeId);
                _session["Authority"] = employeeInfo.Authority;                 //把用户权限等级保存到session中
                return(true);
            }
            return(false);
        }