public Contracts.GenericListResult <Contracts.SmallGroupMember> GetPersonSmallGroupMembership(int id, int start, int max) { Contracts.GenericListResult <Contracts.SmallGroupMember> list = new Contracts.GenericListResult <Contracts.SmallGroupMember>(); Contracts.SmallGroupMemberMapper mapper = new Contracts.SmallGroupMemberMapper(); Contracts.SmallGroupMember member; CategoryCollection cc = new CategoryCollection(); GroupCollection gc = new GroupCollection(); GroupMember gm; // // If they are requesting membership for a person, get the list // of groups this person is a member of. Does not return groups // this person is a leader of. // list.Items = new List <Contracts.SmallGroupMember>(); list.Start = start; list.Max = max; foreach (Category c in cc) { gc = new GroupCollection(); gc.LoadByPersonID(id, c.CategoryID); foreach (Group g in gc) { if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, g.GroupClusterID, OperationType.View) == false) { continue; } if (list.Total >= start && list.Items.Count < max) { gm = new GroupMember(g.GroupID, id); member = mapper.FromArena(new GroupMember(g.GroupID, id)); if (member.Group.ID == -1) { continue; } list.Items.Add(mapper.FromArena(gm)); } list.Total += 1; } } return(list); }
public Contracts.GenericListResult <Contracts.SmallGroupMember> GetSmallGroupMembers(int groupID, int start, int max) { Contracts.GenericListResult <Contracts.SmallGroupMember> list = new Contracts.GenericListResult <Contracts.SmallGroupMember>(); Contracts.SmallGroupMemberMapper mapper = new Contracts.SmallGroupMemberMapper(); Group group = new Group(groupID); int i; if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, group.GroupClusterID, OperationType.View) == false) { throw new Exception("Access denied."); } group.LoadMemberArray(); list.Start = start; list.Max = max; list.Total = group.Members.Count; list.Items = new List <Contracts.SmallGroupMember>(); for (i = start; i < group.Members.Count && (max <= 0 || i < (start + max)); i++) { list.Items.Add(mapper.FromArena(group.Members[i])); } return(list); }
public Contracts.GenericListResult<Contracts.SmallGroupMember> GetSmallGroupMembers(int groupID, int start, int max) { Contracts.GenericListResult<Contracts.SmallGroupMember> list = new Contracts.GenericListResult<Contracts.SmallGroupMember>(); Contracts.SmallGroupMemberMapper mapper = new Contracts.SmallGroupMemberMapper(); Group group = new Group(groupID); int i; if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, group.GroupClusterID, OperationType.View) == false) throw new Exception("Access denied."); group.LoadMemberArray(); list.Start = start; list.Max = max; list.Total = group.Members.Count; list.Items = new List<Contracts.SmallGroupMember>(); for (i = start; i < group.Members.Count && (max <= 0 || i < (start + max)); i++) { list.Items.Add(mapper.FromArena(group.Members[i])); } return list; }
public Contracts.GenericListResult<Contracts.SmallGroupMember> GetPersonSmallGroupMembership(int id, int start, int max) { Contracts.GenericListResult<Contracts.SmallGroupMember> list = new Contracts.GenericListResult<Contracts.SmallGroupMember>(); Contracts.SmallGroupMemberMapper mapper = new Contracts.SmallGroupMemberMapper(); Contracts.SmallGroupMember member; CategoryCollection cc = new CategoryCollection(); GroupCollection gc = new GroupCollection(); GroupMember gm; // // If they are requesting membership for a person, get the list // of groups this person is a member of. Does not return groups // this person is a leader of. // list.Items = new List<Contracts.SmallGroupMember>(); list.Start = start; list.Max = max; foreach (Category c in cc) { gc = new GroupCollection(); gc.LoadByPersonID(id, c.CategoryID); foreach (Group g in gc) { if (RestApi.GroupClusterOperationAllowed(ArenaContext.Current.Person.PersonID, g.GroupClusterID, OperationType.View) == false) continue; if (list.Total >= start && list.Items.Count < max) { gm = new GroupMember(g.GroupID, id); member = mapper.FromArena(new GroupMember(g.GroupID, id)); if (member.Group.ID == -1) continue; list.Items.Add(mapper.FromArena(gm)); } list.Total += 1; } } return list; }