当前位置: 首页>>代码示例>>C#>>正文


C# ContentItem.IsExpired方法代码示例

本文整理汇总了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;
		}
开发者ID:Biswo,项目名称:n2cms,代码行数:14,代码来源:PageFilter.cs

示例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++;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:12,代码来源:FixStateMigration.cs

示例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;
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:37,代码来源:NodeAdapter.cs

示例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();
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:30,代码来源:NodeAdapter.cs

示例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();
		}
开发者ID:jupeterson,项目名称:n2cms,代码行数:24,代码来源:NodeAdapter.cs

示例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();
		}
开发者ID:Biswo,项目名称:n2cms,代码行数:7,代码来源:PublishedFilter.cs


注:本文中的ContentItem.IsExpired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。