public virtual async Task <IActionResult> OnGetAsync() { ValidateModel(); var result = await PermissionAppService.GetAsync(ProviderName, ProviderKey); EntityDisplayName = !string.IsNullOrWhiteSpace(ProviderKeyDisplayName) ? ProviderKeyDisplayName : result.EntityDisplayName; Groups = ObjectMapper .Map <List <PermissionGroupDto>, List <PermissionGroupViewModel> >(result.Groups) .OrderBy(g => g.DisplayName) .ToList(); foreach (var group in Groups) { new FlatTreeDepthFinder <PermissionGrantInfoViewModel>().SetDepths(group.Permissions); } foreach (var group in Groups) { group.IsAllPermissionsGranted = group.Permissions.All(p => p.IsGranted); } SelectAllInAllTabs = Groups.All(g => g.IsAllPermissionsGranted); return(Page()); }
public async Task OnGetAsync() { ValidateModel(); var result = await _permissionAppService.GetAsync(ProviderName, ProviderKey).ConfigureAwait(false); EntityDisplayName = result.EntityDisplayName; Groups = ObjectMapper .Map <List <PermissionGroupDto>, List <PermissionGroupViewModel> >(result.Groups) .OrderBy(g => g.DisplayName) .ToList(); foreach (var group in Groups) { new FlatTreeDepthFinder <PermissionGrantInfoViewModel>().SetDepths(group.Permissions); } foreach (var group in Groups) { group.IsAllPermissionsGranted = group.Permissions.All(p => p.IsGranted); } SelectAllInAllTabs = Groups.All(g => g.IsAllPermissionsGranted); }
/// <summary> /// Return true if is valid /// </summary> /// <returns>Return true or false</returns> public bool IsValid(UInt160 hash) { if (!Abi.Hash.Equals(hash)) { return(false); } return(Groups.All(u => u.IsValid(hash))); }
public bool IsStageOneComplete() { if (Groups == null) { return(false); } return(Groups.All(g => (g.Teams.Count() * 2 - 2) == g.Matches.Count(m => m != null))); }
public void AddChild(string name, BaseMenuTreeNode menuTreeNode) { Children.Add(name, menuTreeNode); if (Groups.All(x => x.Group.Name != menuTreeNode.Group.Name)) { Groups.Add(new MenuTreeGroup(menuTreeNode.Group)); Groups = Groups.OrderBy(x => x.Group.OrderHint).ToList(); } // Insert the item into the correct index var groupIndex = Groups.FindIndex(x => x.Group.Name == menuTreeNode.Group.Name); // Skip to the start of the group var groupStart = 0; for (var i = 0; i < groupIndex; i++) { var g = Groups[i]; groupStart += g.Nodes.Count + (g.HasSplitter ? 1 : 0); } // Add the node to the list and sort var group = Groups[groupIndex]; group.Nodes = group.Nodes.Union(new[] { menuTreeNode }).OrderBy(x => x.OrderHint ?? "").ToList(); // Skip to the start of the node and insert var idx = group.Nodes.IndexOf(menuTreeNode); MenuMenuItem.DropDownItems.Insert(groupStart + idx, menuTreeNode.MenuMenuItem); // Check groups for splitters groupStart = 0; for (var i = 0; i < Groups.Count - 1; i++) { var g = Groups[i]; groupStart += g.Nodes.Count; // Add a splitter to the group if needed if (!g.HasSplitter && g.Nodes.Count > 0) { MenuMenuItem.DropDownItems.Insert(groupStart, new ToolStripSeparator()); g.HasSplitter = true; } groupStart++; } }
private void GroupItem_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == CPublishingGroupItem.IsSelectedPropertyName) { if (Groups.All(arg => arg.IsSelected)) { // Все элементы выбраны chkSelectAll.IsChecked = true; } else if (Groups.All(arg => !arg.IsSelected)) { // Все элементы не выбраны chkSelectAll.IsChecked = false; } else { // Что-то выбрано, а что-то нет chkSelectAll.IsChecked = null; } } }
public Result <bool> RemoveGroup(Group groupToDelete) { var errors = new List <string>(); if (groupToDelete is null) { errors.Add(nameof(groupToDelete)); } if (Groups.All(group => !group.Name.Equals(groupToDelete.Name, StringComparison.OrdinalIgnoreCase))) { errors.Add("Not exists"); } if (errors.Any()) { return(Result <bool> .Fail(errors)); } //GroupInternal.Remove(groupToDelete); return(Result <bool> .Success(true)); }
void UpdateGroups(List <GroupInfo> updates) { for (int i = 0; i < Groups.Count; ++i) { var newGroup = updates.Where(x => x.ID == Groups[i].ID).ToArray(); if (newGroup.Length == 0) { Groups.RemoveAt(i); } else { Groups[i].Update(newGroup[0]); } } foreach (var update in updates) { if (Groups.All(x => x.ID != update.ID)) { Groups.Add(new GroupViewModel(this, update)); } } }
public bool IsValid() { return(Rows.All(CellCollectionIsValid) && Columns.All(CellCollectionIsValid) && Groups.All(CellCollectionIsValid)); }