本文整理汇总了C#中ContentItem.IsExpired方法的典型用法代码示例。如果您正苦于以下问题:C# ContentItem.IsExpired方法的具体用法?C# ContentItem.IsExpired怎么用?C# ContentItem.IsExpired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentItem
的用法示例。
在下文中一共展示了ContentItem.IsExpired方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Match
/// <summary>Matches an item against the current filter.</summary>
/// <param name="item"></param>
/// <returns></returns>
public override bool Match(ContentItem item)
{
var isMatch = item.IsPage;
if (isMatch && RequirePublished)
isMatch &= item.IsPublished() && !item.IsExpired();
if (isMatch && RequireVisible)
isMatch &= item.Visible;
if (isMatch && RequireAuthorized)
isMatch &= new AccessFilter().Match(item);
return isMatch;
}
示例2: Fixit
private void Fixit(ref int updatedItems, ContentItem item)
{
if (item.IsExpired())
item.State = ContentState.Unpublished;
else if (item.IsPublished())
item.State = ContentState.Published;
else
item.State = ContentState.Waiting;
repository.SaveOrUpdate(item);
updatedItems++;
}
示例3: GetNodeFlags
public virtual IEnumerable<string> GetNodeFlags(ContentItem item)
{
var type = item.GetContentType();
var tags = new List<string>();
tags.Add(item.State.ToString());
foreach (var possibleState in Enum.GetValues(typeof(CollectionState)).Cast<CollectionState>())
if (possibleState != CollectionState.Unknown && item.ChildState.HasFlag(possibleState))
tags.Add(possibleState.ToString());
if (!item.IsPublished())
tags.Add("NotPublished");
if (item.IsExpired())
tags.Add("Expired");
if (!item.Visible)
tags.Add("Invisible");
if (item.AlteredPermissions != Permission.None && item.AuthorizedRoles != null && item.AuthorizedRoles.Count > 0)
tags.Add("Locked");
if (Drafts.HasDraft(item))
tags.Add("HasDraft");
if (item.Created.AddDays(3) > Utility.CurrentTime())
tags.Add("Recent");
tags.Add(type.Assembly.GetName().Name);
tags.AddRange(Utility.GetBaseTypesAndSelf(type).Where(t => t != typeof(object)).Select(t => t.Name));
tags.AddRange(type.GetInterfaces().Where(t => t.Namespace.Contains("Definition")).Select(t => t.Name));
var d = Definitions.GetDefinition(item);
tags.AddRange(d.AdditionalFlags);
if (d.RemovedFlags.Any())
tags.RemoveAll(f => d.RemovedFlags.Contains(f));
return tags;
}
示例4: ApplyStateFlags
private void ApplyStateFlags(TreeNode node, ContentItem item)
{
StringBuilder className = new StringBuilder();
if (!item.IsPublished())
className.Append("unpublished ");
else if (item.Published > N2.Utility.CurrentTime().AddDays(-1))
className.Append("day ");
else if (item.Published > N2.Utility.CurrentTime().AddDays(-7))
className.Append("week ");
else if (item.Published > N2.Utility.CurrentTime().AddMonths(-1))
className.Append("month ");
if (item.IsExpired())
{
className.Append("expired ");
}
if (!item.Visible)
{
className.Append("notvisible ");
}
if (item.AlteredPermissions != Permission.None && item.AuthorizedRoles != null && item.AuthorizedRoles.Count > 0)
{
className.Append("locked ");
}
node.CssClass = className.ToString();
}
示例5: GetClassName
private string GetClassName(ContentItem item)
{
StringBuilder className = new StringBuilder();
if (!item.IsPublished())
className.Append("unpublished ");
else if (item.Published > DateTime.Now.AddDays(-1))
className.Append("day ");
else if (item.Published > DateTime.Now.AddDays(-7))
className.Append("week ");
else if (item.Published > DateTime.Now.AddMonths(-1))
className.Append("month ");
if (item.IsExpired())
className.Append("expired ");
if (!item.Visible)
className.Append("invisible ");
if (item.AlteredPermissions != Permission.None && item.AuthorizedRoles != null && item.AuthorizedRoles.Count > 0)
className.Append("locked ");
return className.ToString();
}
示例6: IsPublished
/// <summary>Tells whether the item is published, i.e. now is between it's published and expires dates.</summary>
/// <param name="item">The item to check.</param>
/// <returns>True if the item is published</returns>
public static bool IsPublished(ContentItem item)
{
return item.IsPublished() && !item.IsExpired();
}