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


C# ContentItem.GetDetail方法代码示例

本文整理汇总了C#中ContentItem.GetDetail方法的典型用法代码示例。如果您正苦于以下问题:C# ContentItem.GetDetail方法的具体用法?C# ContentItem.GetDetail怎么用?C# ContentItem.GetDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentItem的用法示例。


在下文中一共展示了ContentItem.GetDetail方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CsvImport

		public CsvImport(ContentItem Model)
		{
			var dcStr = Model.GetDetail("Delimiter", ",");
			if (String.IsNullOrEmpty(dcStr))
				return; // can't do anything.
			 
			var dc = (dcStr == "\\t" ? '\t' : dcStr[0]);
			var dd = Model.GetDetail("Data", string.Empty).Replace('\r', '\n').Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

			var bSkip = Model.GetDetail("Headers", false);
			var nSkip = bSkip ? 1 : 0;

			if (dd.Length - nSkip >= 0)
			{
				Rows = new string[Math.Max(dd.Length - nSkip, 0)][];
				for (int i = nSkip; i < dd.Length && i < Rows.Length; ++i)
					Rows[i] = dd[i].Split(dc);

				if (Model.GetDetail("Sort", false))
					Rows = Rows.Where(f => f.Length > 0).OrderBy(f => f[0]).ToArray();
			}
			HasHeader = bSkip;
			if (bSkip)
				HeaderRow = dd[0].Split(dc);
		}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:25,代码来源:CsvImport.cs

示例2: WriteImage

		/// <summary>Writes an image html to the given writer.</summary>
		/// <param name="item">The item containing the data.</param>
		/// <param name="detailName">The name of the property to write.</param>
		/// <param name="writer">The writer to write to.</param>
		public static void WriteImage(ContentItem item, string detailName, string preferredSize, string alt, string cssClass, System.IO.TextWriter writer)
		{
			string imageUrl = item[detailName] as string;
			if (string.IsNullOrEmpty(imageUrl))
				return;

			cssClass = item.GetDetail(detailName + "_CssClass", cssClass);
			string altText = item.GetDetail(detailName + "_AlternateText", alt);

			cssClass = WriteImage(imageUrl, writer, preferredSize, cssClass, altText);
		}
开发者ID:alexjamesbrown,项目名称:n2cms,代码行数:15,代码来源:DisplayableImageAttribute.cs

示例3: AddImage

 /// <summary>Adds an image control to the container.</summary>
 /// <param name="container">The containing control.</param>
 /// <param name="item">The item containing image informatin.</param>
 /// <param name="detailName">The detail name on the item.</param>
 /// <param name="cssClass">The css class to applky to the image element.</param>
 /// <param name="altText">Alt alternative text to apply to the image element.</param>
 /// <returns>An image control.</returns>
 public static Control AddImage(Control container, ContentItem item, string detailName, string preferredSize, string cssClass, string altText)
 {
     string imageUrl = item[detailName] as string;
     if (!string.IsNullOrEmpty(imageUrl))
     {
         Image image = new Image();
         image.ImageUrl = ImagesUtility.GetExistingImagePath(imageUrl, preferredSize);
         image.AlternateText = item.GetDetail(detailName + "_AlternateText", altText);
         image.CssClass = item.GetDetail(detailName + "_CssClass", cssClass);
         container.Controls.Add(image);
         return image;
     }
     return null;
 }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:21,代码来源:DisplayableImageAttribute.cs

示例4: WriteImage

        /// <summary>Writes an image html to the given writer.</summary>
        /// <param name="item">The item containing the data.</param>
        /// <param name="detailName">The name of the property to write.</param>
        /// <param name="writer">The writer to write to.</param>
        public static void WriteImage(ContentItem item, string detailName, string preferredSize, string alt, string cssClass, System.IO.TextWriter writer)
        {
            string imageUrl = item[detailName] as string;
            if (string.IsNullOrEmpty(imageUrl))
                return;

            TagBuilder tb = new TagBuilder("img");
            tb.Attributes["src"] = ImagesUtility.GetExistingImagePath(imageUrl, preferredSize);
            tb.Attributes["alt"] = item.GetDetail(detailName + "_AlternateText", alt);
            cssClass = item.GetDetail(detailName + "_CssClass", cssClass);
            if (!string.IsNullOrEmpty(cssClass))
                tb.AddCssClass(cssClass);

            writer.Write(tb.ToString());
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:19,代码来源:DisplayableImageAttribute.cs

示例5: ComputeReplacement

		private static string ComputeReplacement(ContentItem item, Match match)
		{
			var pn = match.Groups[1].Value.Split(new[] {':'}, 2);
			try
			{
				var d1 = item.GetDetail(pn[0]);
				if (d1 == null)
				{
					// hard-coded a few properties here to avoid reflection
					if (pn[0] == "Title")
						d1 = item.Title;
					else if (pn[0] == "Url")
						d1 = item.Url;
					else if (pn[0] == "Id")
						d1 = item.ID;
					else if (pn[0] == "Published")
						d1 = item.Published;
					else if (pn[0] == "TranslationKey")
						d1 = item.TranslationKey;
					else if (pn[0] == "SavedBy")
						d1 = item.SavedBy;
					else if (pn[0] == "Updated")
						d1 = item.Updated;
					else if (pn[0] == "Published")
						d1 = item.Published;
					else if (pn[0] == "Path")
						d1 = item.Path;
					else
					{
						// Use Reflection to resolve property. 
						var type = item.GetType();
						var props =
							type.GetProperties().Where(f => f.Name == pn[0]).
								ToArray();
						if (props.Length > 0)
							d1 = props[0].GetValue(item, null);
							// it's a property
						else
						{
							var fields =
								type.GetFields().Where(f => f.Name == pn[0]).
									ToArray();
							if (fields.Length > 0)
								d1 = fields[0].GetValue(item); // it's a field
						}
					}
				}
				if (d1 == null)
					return String.Concat('{', pn[0], ":null}");
				return (pn.Length == 2
					        ? String.Format(
						        String.Concat("{0:", pn[1], '}'), d1)
					        : d1.ToString());
			}
			catch (Exception err)
			{
				return err.ToString();
			}
		}
开发者ID:meixger,项目名称:n2cms,代码行数:59,代码来源:VariableSubstituter.cs

示例6: CsvImport

		public CsvImport(ContentItem Model)
		{
			string dcStr = Model.GetDetail("Delimiter", ",");
			char dc = (dcStr == "\\t" ? '\t' : dcStr[0]);

			var dd = Model.GetDetail("Data", "").Replace('\r', '\n').Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

			var bSkip = Model.GetDetail<bool>("Headers", false);
			var nSkip = bSkip ? 1 : 0;

			Rows = new string[dd.Length - nSkip][];
			for (int i = nSkip; i < dd.Length; ++i)
				Rows[i] = dd[i].Split(dc);
			
			if (Model.GetDetail("Sort", false))
				Rows = Rows.Where(f => f.Length > 0).OrderBy(f => f[0]).ToArray();

			HasHeader = bSkip;
			if (bSkip)
				HeaderRow = dd[0].Split(dc);
		}
开发者ID:meixger,项目名称:n2cms,代码行数:21,代码来源:CsvImport.cs

示例7: GetDocViewerUrlTemplate

		public static string GetDocViewerUrlTemplate(ContentItem model)
		{
			var url = model.GetDetail(DocViewerUrlPropertyKey, "");
			if (string.IsNullOrEmpty(url))
			{
				url = Content.Traverse.StartPage.GetDetail(DocViewerUrlPropertyKey, "");
				if (String.IsNullOrEmpty(url))
				{
					// check web.config configuration
					if (CurrentDocViewerElement != null)
						return CurrentDocViewerElement.Url;
				}
			}
			return url;
		}
开发者ID:rajeshpillai,项目名称:n2cms,代码行数:15,代码来源:DocViewerUtility.cs

示例8: UseDocViewer

		/// <summary>
		/// Determines if a ContentItem is configured to use a custom viewer.
		/// </summary>
		/// <param name="model"></param>
		/// <returns></returns>
		public static bool UseDocViewer(ContentItem model)
		{
			var useViewer = model.GetDetail(UseDocViewerPropertyKey, false);
			if (!useViewer)
			{
				// check site-wide configuration
				useViewer = Content.Traverse.StartPage != null && Content.Traverse.StartPage.GetDetail(UseDocViewerPropertyKey, false);
				if (!useViewer)
				{
					// check web.config configuration
					if (CurrentDocViewerResolver != null)
						return CurrentDocViewerResolver.Enabled;
				}
			}
			return useViewer;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:21,代码来源:DocViewerUtility.cs

示例9: GetDocViewerUrlTemplate

		public static string GetDocViewerUrlTemplate(ContentItem model, string documentUrl)
		{
			var url = model.GetDetail(DocViewerUrlPropertyKey, "");
			if (!string.IsNullOrEmpty(url)) 
				return url;
			url = Content.Traverse.StartPage.GetDetail(DocViewerUrlPropertyKey, "");
			if (!String.IsNullOrEmpty(url)) 
				return url;

			// check web.config configuration
			if (CurrentDocViewerResolver == null) 
				return url;

			var docViewerElement = CurrentDocViewerResolver.GetElementForFilename(documentUrl);
			if (docViewerElement != null)
				return docViewerElement.Url;
			return null;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:18,代码来源:DocViewerUtility.cs

示例10: CreateTemplateInfo

		private TemplateDefinition CreateTemplateInfo(ContentItem template)
		{
			var info = new TemplateDefinition
			{
				Name = template.Name,
				Title = template.Title,
				Description = template.GetDetail(TemplateDescription, ""),
				TemplateUrl = template.Url,
				Definition = map.GetOrCreateDefinition(template.GetContentType(), template.Name),
				TemplateFactory = () =>
				{
					var clone = template.Clone(true);
					clone.SetDetail(TemplateDescription, null, typeof(string));
					clone.Title = "";
					clone.Name = null;
					clone.TemplateKey = template.Name;
					return clone;
				},
				OriginalFactory = () => template
			};
			return info;
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:22,代码来源:ContentTemplateRepository.cs

示例11: CreateTemplateInfo

 private TemplateDefinition CreateTemplateInfo(ContentItem template)
 {
     var clone = template.Clone(true);
     clone.SetDetail(TemplateDescription, null, typeof(string));
     clone.Title = "";
     clone.Name = null;
     clone["TemplateName"] = template.Name;
     var info = new TemplateDefinition
     {
         Name = template.Name,
         Title = template.Title,
         Description = template.GetDetail(TemplateDescription, ""),
         TemplateUrl = template.Url,
         Definition = definitions.GetDefinition(template.GetContentType()).Clone(),
         Template = clone,
         Original = template
     };
     info.Definition.Template = template.Name;
     return info;
 }
开发者ID:ztaff,项目名称:n2cms,代码行数:20,代码来源:ContentTemplateRepository.cs

示例12: GetLinkBuilder

 internal static ILinkBuilder GetLinkBuilder(ContentItem item, string url, string detailName, string target, string cssClass)
 {
     ILinkBuilder builder = new Link(item.GetDetail(detailName + "_Text", detailName), url);
     return builder.Target(item.GetDetail(detailName + "_Target", target))
         .Class(item.GetDetail(detailName + "_CssClass", cssClass));
 }
开发者ID:Jobu,项目名称:n2cms,代码行数:6,代码来源:DisplayableAnchorAttribute.cs

示例13: CreateTemplateInfo

 private ContentTemplate CreateTemplateInfo(ContentItem template)
 {
     var clone = template.Clone(true);
     var info = new ContentTemplate
     {
         Name = template.Name,
         Title = template.Title,
         Description = template.GetDetail(TemplateDescription, ""),
         TemplateUrl = template.Url,
         Definition = definitions.GetDefinition(template.GetContentType()),
         Template = clone,
         Original = template
         //HiddenEditors = (template.GetDetailCollection("HiddenEditors", false) ?? new DetailCollection()).ToList<string>(),
     };
     clone.SetDetail(TemplateDescription, null, typeof(string));
     clone.Title = "";
     clone.Name = null;
     return info;
 }
开发者ID:cherylhanlon,项目名称:Tigers,代码行数:19,代码来源:ContentTemplateRepository.cs


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