public static DataForNewUser GetDataForNewUser(AuthUser user) { if (user == null || user == User.Guest) { return(null); } DataForNewUser userDataProxy = new DataForNewUser(); ConvertUserProxy(userDataProxy, user); userDataProxy.GenderName = user.GenderName; userDataProxy.ExtendedFields = new List <UserExtendedValueProxy>(); foreach (UserExtendedValue extendedValue in user.ExtendedFields) { userDataProxy.ExtendedFields.Add(GetUserExtendedValueProxy(extendedValue)); } userDataProxy.IPAddress = user.LastVisitIP; userDataProxy.IsActive = user.IsActive; userDataProxy.Password = user.Password; userDataProxy.PasswordFormat = (int)user.PasswordFormat; userDataProxy.Signature = user.Signature; userDataProxy.SignatureFormat = (int)user.SignatureFormat; userDataProxy.TimeZone = user.TimeZone; userDataProxy.InviterID = user.InviterID; //getfriend FriendGroupCollection friendgroups = user.FriendGroups; userDataProxy.FriendGroups = new List <MaxLabs.Passport.Proxy.FriendGroupProxy>(); foreach (FriendGroup fg in friendgroups) { MaxLabs.Passport.Proxy.FriendGroupProxy fgp = GetFriendGroupProxy(fg); userDataProxy.FriendGroups.Add(fgp); FriendCollection friends = FriendBO.Instance.GetFriends(user.UserID, fg.GroupID); foreach (MaxLabs.bbsMax.Entities.Friend friend in friends) { fgp.Friends.Add(GetFriendProxy(friend)); } } //getExtendedFields //userDataProxy.ExtendedFields = GetStringKeyValueList(user.ExtendedFields); return(userDataProxy); }
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 <FriendGroupProxy> Friend_GetFriendGroups(int userID) { if (!CheckClient()) { return(null); } List <FriendGroupProxy> groups = new List <FriendGroupProxy>(); FriendGroupCollection temp = FriendBO.Instance.GetFriendGroups(userID); foreach (FriendGroup group in temp) { groups.Add(ProxyConverter.GetFriendGroupProxy(group)); } return(groups); }
private void UpdateFriendsList(FriendGroupCollection newFriends) { if (0 != newFriends.Count) { group.Clear(); for (int i = newFriends.Count - 1; i >= 0; i--) { FriendGroup fg = newFriends[i]; group.Add(fg); } } }