示例#1
0
        private IContentQuery <ConnectorPart, ConnectorPartRecord> ApplyConnectorCriteria(IContent left, ConnectorCriteria criteria, IContentQuery <ConnectorPart, ConnectorPartRecord> query)
        {
            if (criteria == ConnectorCriteria.Auto)
            {
                criteria = (!left.IsPublished() && left.ContentItem.VersionRecord != null && left.ContentItem.VersionRecord.Latest) ? ConnectorCriteria.Drafts : ConnectorCriteria.Published;
            }
            switch (criteria)
            {
            case ConnectorCriteria.Published:
                // Always show published
                query = query.ForVersion(VersionOptions.Published);
                break;

            case ConnectorCriteria.Drafts:
                // Drafted item, get Latest (but exclude deleted)
                query = query.ForVersion(VersionOptions.Latest).Where(c => !c.DeleteWhenLeftPublished);
                break;

            case ConnectorCriteria.DraftsAndDeleted:
                // Drafted item, get Latest (but exclude deleted)
                query = query.ForVersion(VersionOptions.Latest);
                break;
            }
            return(query);
        }
示例#2
0
 private IContentQuery<ConnectorPart, ConnectorPartRecord> ApplyConnectorCriteria(IContent left, ConnectorCriteria criteria, IContentQuery<ConnectorPart, ConnectorPartRecord> query) {
     if (criteria == ConnectorCriteria.Auto)
         criteria = (!left.IsPublished() && left.ContentItem.VersionRecord != null && left.ContentItem.VersionRecord.Latest) ? ConnectorCriteria.Drafts : ConnectorCriteria.Published;
     switch (criteria) {
         case ConnectorCriteria.Published:
             // Always show published
             query = query.ForVersion(VersionOptions.Published);
             break;
         case ConnectorCriteria.Drafts:
             // Drafted item, get Latest (but exclude deleted)
             query = query.ForVersion(VersionOptions.Latest).Where(c => !c.DeleteWhenLeftPublished);
             break;
         case ConnectorCriteria.DraftsAndDeleted:
             // Drafted item, get Latest (but exclude deleted)
             query = query.ForVersion(VersionOptions.Latest);
             break;
     }
     return query;
 }