Exemplo n.º 1
0
        public List<PermissionGroupItemsModel> GetPermissionGroupItemsBySiteId(Guid siteId)
        {
            // 一次性获取所有PermissionItem,不必循环由PermissionGroupId获取
            List<PermissionGroupItemsModel> list = new List<PermissionGroupItemsModel>();

            IList<PermissionGroup> groups = _permissionGroupService.GetAllBySiteId(siteId);
            IList<PermissionItem> items = _permissionItemService.GetAllBySiteId(siteId);
            foreach (PermissionGroup group in groups)
            {
                PermissionGroupItemsModel groupItem = new PermissionGroupItemsModel
                {
                    Group = group
                };
                foreach (PermissionItem item in items)
                {
                    if (item.PermissionGroupId == group.ID)
                    {
                        groupItem.Items.Add(item);
                    }
                }

                list.Add(groupItem);
            }

            return list;
        }
Exemplo n.º 2
0
 public static List<PermissionItem> GetOrderedItems(PermissionGroupItemsModel permissionGroupItems)
 {
     return permissionGroupItems.GetItemsByDisplayStyle(PermissionItemDisplayStyle.CheckBox)
         .Union(permissionGroupItems.GetItemsByDisplayStyle(PermissionItemDisplayStyle.TextBox))
         .Union(permissionGroupItems.GetItemsByDisplayStyle(PermissionItemDisplayStyle.DropDownList))
         .Union(permissionGroupItems.GetItemsByDisplayStyle(PermissionItemDisplayStyle.TreeView)).ToList();
 }