Ejemplo n.º 1
0
    /// <summary>
    /// Gets a collection of the current user's recently edited content items
    /// </summary>
    private IEnumerable <ContentData> loadContentData()
    {
        ContentManager cAPI = new ContentManager();
        UserManager    uAPI = new UserManager();

        var me = uAPI.GetItem(cAPI.UserId, true);

        ContentCriteria criteria = new ContentCriteria();

        criteria.OrderByField = ContentProperty.DateModified;
        criteria.AddFilter(ContentProperty.UserId, CriteriaFilterOperator.EqualTo, me.Id);
        criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "Workspace");
        criteria.AddFilter(ContentProperty.FolderName, CriteriaFilterOperator.NotEqualTo, "_meta_");

        if (this.DaysLimit > 0)
        {
            criteria.AddFilter(ContentProperty.DateModified, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.AddDays(-DaysLimit));
        }

        if (this.PublishedOnly)
        {
            criteria.AddFilter(ContentProperty.Status, CriteriaFilterOperator.EqualTo, "A");
        }

        var list = cAPI.GetList(criteria);

        if (this.ItemLimit > 0)
        {
            list = list.Take(this.ItemLimit).ToList();
        }

        return(list);
    }
    private ContentCriteria GetContentCriteria(long ContentTypeID, DateTime?StartDate = null, DateTime?EndDate = null)
    {
        var criteria = new ContentCriteria(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Descending);

        criteria.AddFilter(Ektron.Cms.Common.ContentProperty.XmlConfigurationId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, ContentTypeID);
        if (StartDate.HasValue && EndDate.HasValue)
        {
            criteria.AddFilter(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.CriteriaFilterOperator.GreaterThanOrEqualTo, StartDate.Value);
            criteria.AddFilter(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.CriteriaFilterOperator.LessThanOrEqualTo, EndDate.Value);
        }
        criteria.PagingInfo = new PagingInfo(1, 1);
        return(criteria);
    }
Ejemplo n.º 3
0
        private void ApplyContentRestrictions <T>(ref ContentCriteria criteria)
        {
            // Restricts results to only Smart Forms that are mapped to this type definition.
            var XmlConfigId = Common.PropertyRequest.GetEktronDefinition(typeof(T));

            criteria.AddFilter(ContentProperty.XmlConfigurationId, CriteriaFilterOperator.EqualTo, XmlConfigId);
        }
Ejemplo n.º 4
0
        private ContentCriteria GetFolderCriteria(long FolderID)
        {
            var criteria = new ContentCriteria();

            criteria.AddFilter(ContentProperty.FolderId, CriteriaFilterOperator.EqualTo, FolderID);
            return(criteria);
        }
Ejemplo n.º 5
0
        private ContentCriteria GetCriteriaForSingleItem(long ItemID)
        {
            var criteria = new ContentCriteria();

            criteria.PagingInfo = new Ektron.Cms.PagingInfo(1, 1);
            criteria.AddFilter(ContentProperty.Id, CriteriaFilterOperator.EqualTo, ItemID);

            // This rule catches both archived and non-archived content.
            // Change to 0 for only non-archived content.
            // Change to 1 for only archived content.
            criteria.AddFilter(ContentProperty.IsArchived, CriteriaFilterOperator.GreaterThan, -1);

            // Because this API is only interested in HTML content
            //criteria.AddFilter(ContentProperty.XmlConfigurationId, CriteriaFilterOperator.EqualTo, 0);

            criteria.ReturnMetadata = true;

            return(criteria);
        }
    private void GetHolidayList()
    {
        ContentTypeManager<HolidayOffers> holidayOfferManager = new ContentTypeManager<HolidayOffers>();
        string folderid = Resources.ID.HolidayOfferFolderId;
        long holidayFolderId = 0;
        bool isFolderId = long.TryParse(folderid, out holidayFolderId);
        if (isFolderId)
        {
            ContentCriteria criteria = new ContentCriteria();
            criteria.AddFilter(ContentProperty.FolderId, CriteriaFilterOperator.EqualTo, holidayFolderId);

            List<ContentType<HolidayOffers>> holidayOffers = holidayOfferManager.GetList(criteria);
            lstOffers.DataSource = holidayOffers;
            lstOffers.DataBind();
        }
    }
 private ContentCriteria GetContentCriteria(long ContentTypeID, DateTime? StartDate = null, DateTime? EndDate = null)
 {
     var criteria = new ContentCriteria(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Descending);
     criteria.AddFilter(Ektron.Cms.Common.ContentProperty.XmlConfigurationId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, ContentTypeID);
     if (StartDate.HasValue && EndDate.HasValue)
     {
         criteria.AddFilter(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.CriteriaFilterOperator.GreaterThanOrEqualTo, StartDate.Value);
         criteria.AddFilter(Ektron.Cms.Common.ContentProperty.DateModified, Ektron.Cms.Common.CriteriaFilterOperator.LessThanOrEqualTo, EndDate.Value);
     }
     criteria.PagingInfo = new PagingInfo(1, 1);
     return criteria;
 }
 internal static List<ContentData> GetContentByFolderPath(string folderPath)
 {
     IContentManager cm = ObjectFactory.GetContent();
     ContentCriteria criteria = new ContentCriteria();
     criteria.AddFilter(ContentProperty.Path, CriteriaFilterOperator.EqualTo, folderPath);
     return cm.GetList(criteria);
 }