Beispiel #1
0
    private void LoadActivityData()
    {
        PagingInfo _Page = new PagingInfo(cmsActivityFeed.MaxResults);
        _Page.CurrentPage = currentPageNumber;
        ActivityCriteria criteria = new ActivityCriteria();
        criteria.PagingInfo = _Page;
        criteria.OrderByDirection = EkEnumeration.OrderByDirection.Descending;
        criteria.OrderByField = Ektron.Cms.Activity.ActivityProperty.Date;
        List<long> userIdlist = new List<long>();
        List<long> groupIdList = new List<long>();

        foreach (string item in FriendPreferences)
        {

            if (userInfo.DisplayName.ToLower() == item.Substring(item.IndexOf(">")+1).ToLower())
            {
                userIdlist.Add(userInfo.Id);
            }
            for (int i = 0; i <= friendList.Length - 1; i++)
            {
                if (friendList[i].DisplayName == item.Substring(item.IndexOf(">") + 1))
                {

                    userIdlist.Add(friendList[i].Id);
                }
            }

        }
        foreach (string groupItem in GroupPreferences)
        {
            for (int i = 0; i <= groupList.Length - 1; i++)
            {
                if (groupList[i].GroupName == groupItem.Substring(groupItem.IndexOf(">") + 1))
                {

                    groupIdList.Add(groupList[i].GroupId);
                }
            }
        }
        criteria.Condition = LogicalOperation.Or;
        if (userIdlist.Count > 0)
        {
            criteria.AddFilter(Ektron.Cms.Activity.ActivityProperty.ActionUserId, CriteriaFilterOperator.In, userIdlist);
        }
        if (groupIdList.Count > 0)
        {
            CriteriaFilterGroup<Ektron.Cms.Activity.ActivityProperty> group = new CriteriaFilterGroup<Ektron.Cms.Activity.ActivityProperty>();
            group.Condition = LogicalOperation.And;
            group.AddFilter(Ektron.Cms.Activity.ActivityProperty.ScopeObjectType, CriteriaFilterOperator.EqualTo, EkEnumeration.ActivityFeedType.CommunityGroup);
            group.AddFilter(Ektron.Cms.Activity.ActivityProperty.ScopeObjectId, CriteriaFilterOperator.In, groupIdList);

            criteria.FilterGroups.Add(group);
        }
        if (userIdlist.Count > 0 || groupIdList.Count > 0)
        {
            ActivityData = _activityApi.GetUserActivityStream(criteria, _activityApi.RequestInformation.UserId);
            totalPagesNumber = criteria.PagingInfo.TotalPages;
         }
         PageSettings();
    }