public List <FriendGroupProxy> Friend_GetFriendGroupsWithFriends(int userID) { if (!CheckClient()) { return(null); } List <FriendGroupProxy> groups = new List <FriendGroupProxy>(); FriendGroupCollection temp = FriendBO.Instance.GetFriendGroups(userID); FriendGroupProxy blackGroup = new FriendGroupProxy(); blackGroup.GroupID = -1; blackGroup.Name = "#black list"; FriendCollection friends = FriendBO.Instance.GetFriendAndBlackList(userID); foreach (BlacklistItem b in friends.Blacklist) { FriendProxy fItem = new FriendProxy(); fItem.GroupID = b.GroupID; fItem.UserID = b.UserID; blackGroup.Friends.Add(fItem); } foreach (FriendGroup fg in temp) { groups.Add(ProxyConverter.GetFriendGroupProxy(fg)); } while (friends.Count > 0) { Friend friend = friends[friends.Count - 1]; FriendProxy fp = ProxyConverter.GetFriendProxy(friend); foreach (FriendGroupProxy proxy in groups) { if (proxy.GroupID == friend.GroupID) { proxy.Friends.Add(fp); } } friends.Remove(friend); } groups.Add(blackGroup); return(groups); }
public List <FriendProxy> Friend_GetFriends(int userID) { if (!CheckClient()) { return(null); } List <FriendProxy> friends = new List <FriendProxy>(); FriendCollection temp = FriendBO.Instance.GetFriends(userID); foreach (Friend friend in temp) { friends.Add(ProxyConverter.GetFriendProxy(friend)); } return(friends); }