Example #1
0
 /// <summary>获得角色列表 
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <returns></returns>
 public List<RoleEntity> GetRoles(int pageIndex, int pageSize, string RoleName, out int count)
 {
     int skip = (pageIndex - 1) * pageSize;
     RoleDal roleDal = new RoleDal();
     List<RoleEntity> roleEntities = roleDal.GetRoles(skip, pageSize, RoleName, out count);
     return roleEntities;
 }
Example #2
0
 /// <summary>获得角色列表 
 /// </summary>
 /// <param name="roleIdList"></param>
 /// <returns></returns>
 public List<RoleEntity> GetRoles(List<int> roleIdList)
 {
     if (roleIdList == null || !roleIdList.Any())
         return new List<RoleEntity>();
     roleIdList = roleIdList.Distinct().ToList();
     RoleDal roleDal = new RoleDal();
     return roleDal.GetRoles(roleIdList);
 }
Example #3
0
 /// <summary>删除角色 
 /// </summary>
 /// <param name="roleId">角色Id</param>
 /// <returns></returns>
 public bool DeleteRole(int roleId)
 {
     RoleDal roleDal = new RoleDal();
     if (roleDal.DeleteRole(roleId))
     {
         UserDal userDal = new UserDal();
         return userDal.RemoveRole(roleId);
     }
     return false;
 }
Example #4
0
 /// <summary>修改角色信息 
 /// </summary>
 /// <param name="roleEntity"></param>
 /// <returns></returns>
 public bool UpdateRole(RoleEntity roleEntity)
 {
     RoleDal roleDal = new RoleDal();
     return roleDal.UpdateRole(roleEntity);
 }
Example #5
0
 /// <summary>添加角色 
 /// </summary>
 /// <param name="roleEntity"></param>
 /// <returns></returns>
 public bool AddRole(RoleEntity roleEntity)
 {
     RoleDal roleDal = new RoleDal();
     return roleDal.AddRole(roleEntity);
 }
Example #6
0
 public List<RoleEntity> GetRoles()
 {
     RoleDal roleDal = new RoleDal();
     List<RoleEntity> roleEntities = roleDal.GetRoles();
     return roleEntities;
 }
Example #7
0
 public bool UpdateRight(int rightId, string rights)
 {
     RoleDal roleDal = new RoleDal();
     return roleDal.UpdateRight(rightId, rights);
 }
Example #8
0
 /// <summary>移除权限 
 /// </summary>
 /// <param name="roleId">角色Id</param>
 /// <param name="rightId">权限Id</param>
 /// <returns></returns>
 public bool RemoveRight(int roleId, int rightId)
 {
     RoleDal roleDal = new RoleDal();
     return roleDal.RemoveRight(roleId, rightId);
 }
Example #9
0
 /// <summary>添加权限 
 /// </summary>
 /// <param name="roleId">角色Id</param>
 /// <param name="rightId">权限Id</param>
 /// <returns></returns>
 public bool AddRight(int roleId, int rightId)
 {
     RoleDal roleDal = new RoleDal();
     return roleDal.AddRight(roleId, rightId);
 }
Example #10
0
        /// <summary>删除权限,真删,同时移出角色表中的权限
        /// </summary>
        /// <param name="rightId"></param>
        /// <returns></returns>
        public bool DeleteRightRel(List<int> rightIds)
        {
            foreach (var item in rightIds)
            {
                //在角色表中移出权限
                RoleDal roleDal = new RoleDal();
                roleDal.RemoveRight(item);
            }

            //删除权限
            RightDal rightDal = new RightDal();
            return rightDal.DeleteRightRel(rightIds);
        }