示例#1
0
        public static FriendProxy GetFriendProxy(MaxLabs.bbsMax.Entities.Friend friend)
        {
            if (friend == null) return null;

            FriendProxy friendProxy = new FriendProxy();
            friendProxy.UserID = friend.UserID;
            friendProxy.OwnerID = friend.OwnerID;
            friendProxy.Hot = friend.Hot;
            friendProxy.GroupID = friend.GroupID;
            friendProxy.CreateDate = friend.CreateDate.AddHours(-DateTimeUtil.DatabaseTimeDifference);
            return friendProxy;
        }
示例#2
0
        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;
        }