示例#1
0
        public static Query <TRow> FindFriends <TRow>(FriendQuery query) where TRow : Row
        {
            var status = "%";

            switch (query.Status)
            {
            case FriendStatusFilter.Approved:
                status = GSFriendStatus.APPROVED;
                break;

            case FriendStatusFilter.Banned:
                status = GSFriendStatus.BANNED;
                break;

            case FriendStatusFilter.PendingApproval:
                status = GSFriendStatus.PENDING;
                break;
            }

            return(new Query <TRow>("Graph.Server.Data.Scripts.Friend.FindFriends")
            {
                new Query.Param("pNode", query.G_Node),
                new Query.Param("pList", query.Lists),
                new Query.Param("pStatus", status),
                new Query.Param("pFetchStart", query.FetchStart),
                new Query.Param("pFetchCount", query.FetchCount)
            });
        }
示例#2
0
 /// <summary>
 /// Returns an enumeration of FriendConnection{GraphNode, approve date, direction, groups}
 /// </summary>
 IEnumerable <FriendConnection> IGraphFriendSystem.GetFriendConnections(FriendQuery query)
 {
     try
     {
         return(DoGetFriendConnections(query));
     }
     catch (Exception ex)
     {
         Log(MessageType.Error, "GetFriendConnections", ex.ToMessageWithType(), ex);
         throw new GraphException(StringConsts.GS_GET_FRIEND_CONNECTIONS_ERROR.Args(query.ToString()), ex);
     }
 }
示例#3
0
        protected virtual IEnumerable <FriendConnection> DoGetFriendConnections(FriendQuery query, ICacheParams cacheParams = null)
        {
            var rows = ForNode(query.G_Node).LoadEnumerable(Queries.FindFriends <FriendRow>(query));

            foreach (var row in rows)
            {
                var friendNode = DoGetNode(row.G_Friend, cacheParams);
                foreach (var graphNode in GraphHost.FilterByOriginQuery(new[] { friendNode }, query.OriginQuery))
                {
                    yield return(new FriendConnection(graphNode,
                                                      row.Request_Date,
                                                      FriendStatus.Approved.Equals(GSFriendStatus.ToFriendStatus(row.Status))
              ? (DateTime?)row.Status_Date
              : null,
                                                      GSFriendshipRequestDirection.ToFriendshipRequestDirection(row.Direction),
                                                      GSFriendVisibility.ToFriendVisibility(row.Visibility),
                                                      row.Lists));
                }
            }
        }
示例#4
0
 public IEnumerable <FriendConnection> GetFriendConnections(FriendQuery query)
 {
     return(Friends.GetFriendConnections(query));
 }