Exemple #1
0
        /// <summary>
        /// 设置一个用户所属的权限组
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="groupId"></param>
        /// <returns></returns>
        public bool SetUserPmsGroup(string userId, long groupId)
        {
            Model.UserPmsGroupRelationInfo model = new Model.UserPmsGroupRelationInfo()
            {
                UserID = userId, GroupID = groupId
            };

            if (BaseCacheGetUserPmsGroupRelationList(userId).Exists(p => p.GroupID == groupId))
            {
                return(false);
            }

            return(Add(model));
        }
Exemple #2
0
 /// <summary>
 /// 移除一个用户所属的权限组
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="groupId"></param>
 /// <returns></returns>
 public bool RemoteUserPmsGroup(string userId, long groupId)
 {
     Model.UserPmsGroupRelationInfo model = new Model.UserPmsGroupRelationInfo()
     {
         UserID = userId, GroupID = groupId
     };
     if (!BaseCacheGetUserPmsGroupRelationList(userId).Exists(p => p.GroupID == groupId))
     {
         return(false);
     }
     if (Delete(model) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }