public static void ExecuteMethod_UpdateAccountContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, GroupSummaryContainer groupSummaryContainer, TBRAccountRoot accountRoot, AccountContainer accountContainer) { string currRootId = groupRoot.Group.ID; string currReferenceUrlPrefix = String.Format("/auth/grp/{0}/", currRootId); var currRoles = accountContainer.AccountModule.Roles; currRoles.MemberInGroups.CollectionContent.RemoveAll( refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix)); currRoles.ModeratorInGroups.CollectionContent.RemoveAll( refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix)); foreach (var acctRole in accountRoot.Account.GroupRoleCollection.CollectionContent.Where(role => role.GroupID == currRootId)) { ReferenceToInformation reference = ReferenceToInformation.CreateDefault(); reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml", currRootId); reference.Title = currGroup.GroupName + " - " + acctRole.GroupRole; switch (acctRole.GroupRole.ToLower()) { case "initiator": case "moderator": currRoles.ModeratorInGroups.CollectionContent.Add(reference); break; case "collaborator": case "viewer": currRoles.MemberInGroups.CollectionContent.Add(reference); break; } } currRoles.ModeratorInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle); currRoles.MemberInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle); // TODO: Update account summary //accountContainer.AccountSummary.GroupSummary }
public static void ExecuteMethod_UpdateGroupSummaryContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, TBRAccountRoot accountRoot, GroupSummaryContainer groupSummaryContainer) { string currRootId = groupRoot.Group.ID; string currGroupID = currGroup.ID; bool isMember = accountRoot.Account.GroupRoleCollection.CollectionContent.Exists( grp => grp.GroupID == currRootId); groupSummaryContainer.GroupCollection.CollectionContent.RemoveAll( grp => grp.ID == currGroupID); if(isMember) { groupSummaryContainer.GroupCollection.CollectionContent.Add(currGroup); currGroup.UpdateReferenceToInformation(currRootId); } groupSummaryContainer.GroupCollection.CollectionContent.Sort(Group.CompareByGroupName); }
private static int NameComparer(Group x, Group y) { return String.Compare(x.GroupName, y.GroupName); }