private void FillTreeUsers() { UserGroups.Refresh(); Userods.Refresh(); treeUsers.Nodes.Clear(); List <Userod> usersForGroup; TreeNode groupNode; TreeNode userNode; for (int i = 0; i < UserGroups.List.Length; i++) { groupNode = new TreeNode(UserGroups.List[i].Description); groupNode.Tag = UserGroups.List[i].UserGroupNum; usersForGroup = Userods.GetForGroup(UserGroups.List[i].UserGroupNum); for (int j = 0; j < usersForGroup.Count; j++) { userNode = new TreeNode(usersForGroup[j].UserName); userNode.Tag = usersForGroup[j].UserNum; groupNode.Nodes.Add(userNode); } treeUsers.Nodes.Add(groupNode); } treeUsers.ExpandAll(); treeUsers.SelectedNode = treeUsers.Nodes[0]; SelectedGroupNum = UserGroups.List[0].UserGroupNum; }
///<summary>Fills listAssociatedUsers, which displays the users that are currently associated to the selected usergroup. ///This also dynamically sets the height of the control.</summary> private void FillAssociatedUsers() { listAssociatedUsers.Items.Clear(); List <Userod> listUsers = Userods.GetForGroup(SelectedUserGroup.UserGroupNum); foreach (Userod userCur in listUsers) { listAssociatedUsers.Items.Add(new ODBoxItem <Userod>(userCur.UserName, userCur)); } if (listAssociatedUsers.Items.Count == 0) { listAssociatedUsers.Items.Add(new ODBoxItem <Userod>(Lan.g(this, "None"))); } }