Пример #1
0
 internal PollsQueryBuilder(Group group, User accessingUser, Guid[] groupsToQuery, PollsApi.PollsListOptions options)
 {
     query = options;
     _group = group;
     _accessingUser = accessingUser;
     _groupsToQuery = groupsToQuery;
     _parameters = new List<SqlParameter>();
 }
Пример #2
0
 private static string PollsCacheKey(Guid applicationId, PollsApi.PollsListOptions options)
 {
     return string.Concat("Polling_PK_Polls:"
         , TEApi.Users.AccessingUser.Id.Value
         , ":", applicationId
         , ":", options.IsEnabled
         , ":", options.IsSuspectedAbusive
         , ":", options.AuthorUserId
         , ":", options.PageIndex
         , ":", options.PageSize
         , ":", options.SortBy
         , ":", options.SortOrder);
 }
Пример #3
0
        internal static PagedList<Poll> ListPolls(int groupId, PollsApi.PollsListOptions options)
        {
            var group = TEApi.Groups.Get(new GroupsGetOptions() { Id = groupId });
            if (group == null)
                return new PagedList<Poll>();

            Guid[] filterGroupIds = null;
            if (options.IncludeSubGroups == true)
            {
                var groupsToQuery = TEApi.Groups.List(new GroupsListOptions() { IncludeAllSubGroups = true, ParentGroupId = groupId, PageSize = 9999 });
                groupsToQuery.Add(group);

                IEnumerable<Guid> ids;
                ids = from g1 in groupsToQuery
                        select g1.ApplicationId;

                filterGroupIds = ids.ToArray();

                if (filterGroupIds.Length == 0)
                    return new PagedList<Poll>();
            }

            //PagedList<Poll> polls = (PagedList<Poll>)CacheService.Get(PollsCacheKey(group.ApplicationId, options), CacheScope.Context | CacheScope.Process);
            //if (polls == null)
            //{
            var polls = PollingDataService.ListPolls(group, TEApi.Users.AccessingUser, filterGroupIds, options);
                //CacheService.Put(PollsCacheKey(group.ApplicationId, options), polls, CacheScope.Context | CacheScope.Process, new string[] { PollTag(group.ApplicationId) });
            //}

            return polls;
        }