Esempio n. 1
0
        /// <summary>
        /// 当用户登录成功时,搜集整理用户信息
        /// </summary>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        internal static IdentityInfo CollectUserInfoWhenLogined(IdentityInfo waitHandlerModel, string userId)
        {
            var user = UserInfoHandler.GetLoginedUserInfo(userId);

            waitHandlerModel.LoginedUser = user;
            RoleManager rm         = new RoleManager();
            var         matchRoles = rm.GetUserMatchRoles(user.UserId);

            if (matchRoles != null)
            {
                waitHandlerModel.MatchRoleList = matchRoles;
            }
            var matchRoleModules = rm.GetMatchModuleNavs(user.UserId);

            if (matchRoleModules != null)
            {
                waitHandlerModel.MatchModulePowerList = matchRoleModules;
            }
            return(waitHandlerModel);
        }
Esempio n. 2
0
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public OpResult RegistUser(RegistUserModel user)
        {
            int record = 0;

            if (registerRep.IsExist(e => e.UserId == user.UserId))
            {
                return(OpResult.SetSuccessResult("该用户已经存在!", false));
            }
            var UserOrganizeInfo = UserInfoHandler.GetLoginedUserInfo(user.UserId);

            if (UserOrganizeInfo != null)
            {
                user.CurrentStatus = "可使用";
                user.UserName      = UserOrganizeInfo.UserName;
                record             = registerRep.Insert(user);
                return(OpResult.SetSuccessResult("添加用户成功!", record > 0));
            }
            else
            {
                return(OpResult.SetErrorResult("人事系统中没有此用户信息!"));
            }
        }