本文整理汇总了C#中UmbracoHelper.TypedContentAtXPath方法的典型用法代码示例。如果您正苦于以下问题:C# UmbracoHelper.TypedContentAtXPath方法的具体用法?C# UmbracoHelper.TypedContentAtXPath怎么用?C# UmbracoHelper.TypedContentAtXPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UmbracoHelper
的用法示例。
在下文中一共展示了UmbracoHelper.TypedContentAtXPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListing
/// <summary>
/// get project listing based on GUID
/// </summary>
/// <param name="guid"></param>
/// <param name="optimized">if set performs less DB interactions to increase speed.</param>
/// <returns></returns>
public IListingItem GetListing(Guid guid, bool optimized = false)
{
var strGuid = guid.ToString().ToUpper();
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
// we have to use the translate function to ensure that the casing is the same for comparison as there are GUIDS in the db in both upper and lowercase
var contents =
umbracoHelper.TypedContentAtXPath(
string.Format(
"//Project [@isDoc and translate(packageGuid,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = translate('{0}','ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]",
strGuid));
var content = contents.FirstOrDefault();
if (content != null)
{
return content.ToIListingItem(optimized);
}
throw new NullReferenceException("Node is Null cannot find a node with the guid:" + strGuid);
}
示例2: GetXmlSiteMap
public static IEnumerable<IPublishedContent> GetXmlSiteMap()
{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
return umbracoHelper.TypedContentAtXPath("/root/pubMainPage|/root/pubMainPage//*[@id and not(excludeFromXmlSiteMap='1') and not(ancestor::*[excludeFromXmlSiteMap='1']) and not(ancestor::*[excludeChildrenFromXmlSiteMap='1'])]");
}
示例3: GetOrderStatusNodes
internal static IEnumerable<IPublishedContent> GetOrderStatusNodes()
{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
return umbracoHelper.TypedContentAtXPath(ORDER_STATUSES_XPATH);
}
示例4: HasCategorySales
public static bool HasCategorySales(this IPublishedContent category)
{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var subCategories = category.Descendants("catCategory");
var products = subCategories.SelectMany(x =>
{
var subCategory = umbracoHelper.TypedContent(x.GetPropertyValue<string>("reference"));
var subCategoryEtechnoId = subCategory == null ? "" : subCategory.GetPropertyValue<string>("etechnoId");
return umbracoHelper.TypedContentAtXPath("/root/catProducts//catProduct[contains(concat(',', categories/text(), ','), '," + subCategoryEtechnoId + ",')]");
});
return products.Any(x =>
{
var priceRegular = Unico.Finance.Helper.GetRoublePrice(x.GetPropertyValue<string>("priceRegular"));
var priceSpecial = x.HasValue("priceSpecial") ? Unico.Finance.Helper.GetRoublePrice(x.GetPropertyValue<string>("priceSpecial")) : 0m;
return x.HasValue("priceSpecial") && priceSpecial < priceRegular;
});
}
示例5: AllDescendantsAtXPath
public static IEnumerable<IPublishedContent> AllDescendantsAtXPath(this IPublishedContent content,
UmbracoHelper umbraco, params string[] childNodeTypes)
{
var xpath = AllDescentandsXPath(content, childNodeTypes);
return umbraco.TypedContentAtXPath(xpath);
}