本文整理汇总了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>();
}
示例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);
}
}
}
}
}
示例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>");
}
}
示例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);
}
}
}
}
示例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)
})
}
}
};
}
示例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);
}
}
}
示例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);
});
}
示例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);
}
}
}
示例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);
}
}
}
示例12: GetPromotionEventDataSource
private object GetPromotionEventDataSource(Item listParentItem)
{
Debug.ArgumentNotNull(listParentItem, "listparentitem");
return listParentItem.GetChildren();
}
示例13: GetClassSectionsDataSource
private object GetClassSectionsDataSource(Item currentItem)
{
Debug.ArgumentNotNull(currentItem, "currentitem");
return currentItem.GetChildren();
}
示例14: GetChildrenDataSource
private object GetChildrenDataSource(Item listParentItem)
{
Debug.ArgumentNotNull(listParentItem, "currentitem");
return listParentItem.GetChildren();
}
示例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;
}