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


C# UmbracoHelper.TypedContentAtXPath方法代码示例

本文整理汇总了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);
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:28,代码来源:NodeListingProvider.cs

示例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'])]");
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:5,代码来源:Unico.Etechno.SiteMapHelper.cs

示例3: GetOrderStatusNodes

 internal static IEnumerable<IPublishedContent> GetOrderStatusNodes()
 {
     var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
     return umbracoHelper.TypedContentAtXPath(ORDER_STATUSES_XPATH);
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:5,代码来源:Unico.Etechno.OrdersAdmin.cs

示例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;
     });
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:17,代码来源:Unico.Etechno.Catalog.cs

示例5: AllDescendantsAtXPath

 public static IEnumerable<IPublishedContent> AllDescendantsAtXPath(this IPublishedContent content,
     UmbracoHelper umbraco, params string[] childNodeTypes)
 {
     var xpath = AllDescentandsXPath(content, childNodeTypes);
     return umbraco.TypedContentAtXPath(xpath);
 }
开发者ID:bgadiel,项目名称:tt,代码行数:6,代码来源:PublishedContentExtensions.cs


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