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


C# Item.GetChildren方法代码示例

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


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

示例1: GetLookupValues

 private IEnumerable<Item> GetLookupValues(BaseDataMap map, Item listParent, string importValue, string value)
 {
     if (!lookupValues.Any())
     {
         var listItems = listParent.GetChildren();
         foreach (Item item in listItems)
         {
             var lookupValue = item[MatchOnFieldName].ToLower();
             if (!lookupValues.ContainsKey(lookupValue))
             {
                 lookupValues.Add(lookupValue, new List<Item> {item});
             }
             else
             {
                 var itemList = lookupValues[lookupValue];
                 if (itemList != null)
                 {
                     if (!itemList.Contains(item))
                     {
                         itemList.Add(item);
                     }
                 }
             }
         }
     }
     if (lookupValues.ContainsKey(value))
     {
         return lookupValues[value];
     }
     return new List<Item>();
 }
开发者ID:NetlabSharedSource,项目名称:SitecoreDataSync,代码行数:31,代码来源:ListValueToGuidMatchOnField.cs

示例2: GetMatchingChildItem

 public virtual IEnumerable<Item> GetMatchingChildItem(BaseDataMap map, Item listParent, string importValue)
 {
     IEnumerable<Item> t = (from Item c in listParent.GetChildren()
                            where c.DisplayName.ToLower().Equals(StringUtility.GetNewItemName(importValue, 60))
                            select c).ToList();
     return t;
 }
开发者ID:NetlabSharedSource,项目名称:SitecoreUserSync,代码行数:7,代码来源:ToGuidFromListValueMatchOnDisplayNameField.cs

示例3: GetRandomRelativePaths

        public static void GetRandomRelativePaths(Item currentItem, ref StringCollection stringCollection)
        {
            if (stringCollection == null)
                stringCollection = new StringCollection();

            if (currentItem != null)
            {
                var children = currentItem.GetChildren(ChildListOptions.None);
                if (children != null)
                {
                    foreach (Item child in children)
                    {
                        if (child.Fields["__Renderings"] != null && !String.IsNullOrEmpty(child.Fields["__Renderings"].ToString()))
                        {
                            string url = Sitecore.Links.LinkManager.GetItemUrl(child);

                            var aspxExtension = ".aspx";
                            if (!url.EndsWith(aspxExtension))
                                url += aspxExtension;

                            stringCollection.Add(url);
                            GetRandomRelativePaths(child, ref stringCollection);
                        }
                    }
                }
            }
        }
开发者ID:JimmieOverby,项目名称:SitecoreTrafficGenerator,代码行数:27,代码来源:ItemHelper.cs

示例4: GetMatchingChildItem

 public override IEnumerable<Item> GetMatchingChildItem(BaseDataMap map, Item listParent, string importValue)
 {
     IEnumerable<Item> t = (from Item c in listParent.GetChildren()
                            where c[MatchOnFieldName].ToLower().Equals(importValue.ToLower())
                            select c).ToList();
     return t;
 }
开发者ID:NetlabSharedSource,项目名称:SitecoreUserSync,代码行数:7,代码来源:ToGuidFromListValueMatchOnFieldNameField.cs

示例5: RenderChildren

        private void RenderChildren(Item currentItem)
        {
            if (currentItem["show in menu"].Equals("1"))
            {
                ChildList children = currentItem.GetChildren();

                _sb.AppendFormat("<li><a href=\"{0}\">{1}</a></li><ul>", Links.LinkManager.GetItemUrl(currentItem),
                                FieldRenderer.Render(currentItem, "title"));

                foreach (Item child in children)
                {
                    RenderChildren(child);
                }

                _sb.Append("</ul>");
            }
        }
开发者ID:steen-pedersen,项目名称:SitecoreEcommerceServicesStarterKit,代码行数:17,代码来源:TechPub+LeftMenu.ascx.cs

示例6: LoadImagePanels

 private void LoadImagePanels(Item panelRoot, string rootUrl)
 {
     if (panelRoot.HasChildren)
     {
         foreach (Item panelParent in panelRoot.GetChildren())
         {
             PageSummaryItem current = new PageSummaryItem(panelParent);
             if (!current.Hidefrommenu.Checked)
             {
                 ImagePanel panel = this.Page.LoadControl("~/layouts/virginactive/navigation/ImagePanel.ascx") as ImagePanel;
                 panel.ContextItem = current;
                 panel.RootUrl = rootUrl; //Set a root URL because we want to generate jump links and section QS value
                 phPanels.Controls.Add(panel);
             }
         }
     }
 }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:17,代码来源:FacilitiesClassesLanding.ascx.cs

示例7: CreateResponseModelForItem

 private ServerResponseModel CreateResponseModelForItem(Item item, string device,
                                                        string[] itemFields,
                                                        string[] childFields,
                                                        string mediaBaseUrl)
 {
     return new ServerResponseModel
     {
         Items = new[]
         {
             new ItemModel
             {
                 Properties = MapItem(item),
                 Fields = MapFields(item, itemFields, mediaBaseUrl),
                 Presentation = MapPresentation(item, device),
                 Children = item.GetChildren().Select(child => new ItemModel
                 {
                     Properties = MapItem(child),
                     Fields = MapFields(child, childFields, mediaBaseUrl)
                 })
             }
         }
     };
 }
开发者ID:jballe,项目名称:Lightcore,代码行数:23,代码来源:ItemSerializer.cs

示例8: ProcessMediaItems

        public void ProcessMediaItems(Item rootMediaItem, bool recursive)
        {
            if (rootMediaItem.TemplateID != TemplateIDs.MediaFolder
                && rootMediaItem.TemplateID != TemplateIDs.MainSection)
            {
                string statusMessage = "Processed " + Context.Job.Status.Processed + " items";
                Log.Info(statusMessage, this);

                // Update the job status
                Context.Job.Status.Processed++;
                Context.Job.Status.Messages.Add(statusMessage);

                var mediaItem = new MediaItem(rootMediaItem);
                AddMediaItemToZip(mediaItem);
            }
            else if (recursive)
            {
                foreach (Item item in rootMediaItem.GetChildren())
                {
                    ProcessMediaItems(item, true);
                }
            }
        }
开发者ID:sc0y,项目名称:sitecore-media-exporter,代码行数:23,代码来源:MediaExporter.cs

示例9: RenderChildItems

        /// <summary>
        /// This function is responsible for pulling the actual Rendering for current device that's loaded and
        /// essentially 
        /// </summary>
        /// <param name="rootItem">The root item in which we need to get the child items to render.</param>
        /// <param name="placeholder">The place holder in which we want to place the child items into.</param>
        private void RenderChildItems(Item rootItem, PlaceHolder placeholder)
        {
            rootItem.GetChildren()
                .ToList()
                .ForEach(item =>
                {
                    // We need to get the path of the actual Sublayout's path
                    // First we need to get the device's rendering for this child item (assume the first returned rendering)
                    RenderingReference renderingReference = item
                        .Visualization
                        .GetRenderings(Sitecore.Context.Device, false)
                        .First();

                    // Now, get the actual sublayout item itself
                    Item sublayoutItem = Sitecore.Context.Database
                        .GetItem(renderingReference.RenderingID);

                    // Create a new sublayout with the sublayout's path and data item path.
                    Sublayout sublayout = new Sublayout
                    {
                        Path = sublayoutItem["Path"],
                        DataSource = item.Paths.Path
                    };

                    // now place this sublayout on the grid.
                    placeholder.Controls.Add(sublayout);
                });
        }
开发者ID:hikirsch,项目名称:Sitecore-Grid-Demo,代码行数:34,代码来源:GridComponent.cs

示例10: GetChildItemsHelper

        protected void GetChildItemsHelper(Item item, bool recurse, WildcardPattern wildcard, string language,
            int version)
        {
            var children = item.GetChildren();
            foreach (Item childItem in children)
            {
                var child = childItem;
                if (wildcard.IsMatch(child.Name))
                {
                    WriteMatchingItem(language, version, child);
                }

                if (recurse)
                {
                    GetChildItemsHelper(child, true, wildcard, language, version);
                }
            }
        }
开发者ID:sobek85,项目名称:Console,代码行数:18,代码来源:PsSitecoreItemProvider.cs

示例11: SerializeToTargetLanguage

        private void SerializeToTargetLanguage(Item item, string target, Language language, bool recursive)
        {
            WriteVerbose(String.Format("Serializing item '{0}' to target '{1}'", item.Name, target));
            WriteDebug(String.Format("[Debug]: Serializing item '{0}' to target '{1}'", item.Name, target));

            if (string.IsNullOrEmpty(target))
            {
                Manager.DumpItem(item);
            }
            else
            {
                target = target.EndsWith("\\") ? target + item.Name : target + "\\" + item.Name;
                Manager.DumpItem(target + ".item", item);
            }
            if (recursive)
            {
                foreach (Item child in item.GetChildren(ChildListOptions.IgnoreSecurity))
                {
                    SerializeToTargetLanguage(child, target, language, true);
                }
            }
        }
开发者ID:scjunkie,项目名称:Console,代码行数:22,代码来源:SerializeItemCommand.cs

示例12: GetPromotionEventDataSource

 private object GetPromotionEventDataSource(Item listParentItem)
 {
     Debug.ArgumentNotNull(listParentItem, "listparentitem");
     return listParentItem.GetChildren();
 }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:5,代码来源:Header.ascx.cs

示例13: GetClassSectionsDataSource

 private object GetClassSectionsDataSource(Item currentItem)
 {
     Debug.ArgumentNotNull(currentItem, "currentitem");
     return currentItem.GetChildren();
 }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:5,代码来源:Header.ascx.cs

示例14: GetChildrenDataSource

 private object GetChildrenDataSource(Item listParentItem)
 {
     Debug.ArgumentNotNull(listParentItem, "currentitem");
     return listParentItem.GetChildren();
 }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:5,代码来源:Header.ascx.cs

示例15: CreateAndReturnDateFolderDestination

        /// <summary>
        /// Given a destination Item, this will create the structures on this item to host unstructured data
        /// </summary>
        /// <returns>This will return the destination parent Item that hosts the new Item</returns>
        /// <param name="topParent">Gets the root of where this item will be created</param>
        /// <param name="childItemCreationDateTime">Determins the folder that the item will be created within</param>
        internal static Item CreateAndReturnDateFolderDestination(Item topParent, DateTime childItemCreationDateTime)
        {
            Contract.Requires(topParent.IsNotNull());
            Contract.Requires(childItemCreationDateTime.IsNotNull());

            var database = topParent.Database;
            var dateFolder = childItemCreationDateTime.ToString(Config.BucketFolderPath);
            DateTimeFormatInfo dateTimeInfo = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;

            if (dateTimeInfo.DateSeparator != Constants.ContentPathSeperator)
            {
                Log.Info("ItemBuckets. DateTimeFormat inconsistency. Current date separator is " + dateTimeInfo.DateSeparator + " and time separator is " + dateTimeInfo.TimeSeparator + ". Relative path to folder is " + dateFolder, new object());
                dateFolder = dateFolder.Replace(dateTimeInfo.DateSeparator, Constants.ContentPathSeperator).Replace(dateTimeInfo.TimeSeparator,Constants.ContentPathSeperator);
            }

            var destinationFolderPath = topParent.Paths.FullPath + Constants.ContentPathSeperator + dateFolder;
            Item destinationFolderItem;

            // TODO: Use the Path Cache to determine if the path exists instead of looking it up on the item everytime I create an item (will be noticed if programmatically adding items)
            if ((destinationFolderItem = database.GetItem(destinationFolderPath)).IsNull())
            {
                var containerTemplate = database.Templates[new TemplateID(Config.ContainerTemplateId)];
                destinationFolderItem = database.CreateItemPath(destinationFolderPath, containerTemplate, containerTemplate);
            }

            using (new SecurityDisabler())
            {
                topParent.GetChildren().ToList().ForEach(HideItem);
            }

            Contract.Ensures(destinationFolderItem.IsNotNull());

            return destinationFolderItem;
        }
开发者ID:hQst,项目名称:Sitecore-Item-Buckets,代码行数:40,代码来源:BucketManager.cs


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