/// <summary>
/// Updates the <see cref="Item.DisplayTabId"/> and <see cref="ChildDisplayTabId"/> settings of all children of this <see cref="Category"/> (and their children's children, etc.)
/// </summary>
/// <param name="revisingUser">The revising user.</param>
/// <returns>The number of affected <see cref="Item"/>s</returns>
public int CascadeChildDisplayTab(int revisingUser)
{
int count = 0;
foreach (DataRow itemRow in GetAllChildren(ItemId, Util.RelationshipType.ItemToParentCategory.GetId(), PortalId).Tables[0].Rows)
{
Item childItem;
var itemId = (int)itemRow["itemId"];
if (GetItemTypeId(itemId) == ItemType.Article.GetId())
{
childItem = Article.GetArticle(itemId, PortalId, true, true, true);
}
else
{
childItem = GetCategory(itemId, true, true);
}
childItem.DisplayTabId = ChildDisplayTabId;
var childCategory = childItem as Category;
if (childCategory != null)
{
childCategory.ChildDisplayTabId = ChildDisplayTabId;
}
Setting displayOnCurrentPageSetting = Setting.ArticleSettingCurrentDisplay;
displayOnCurrentPageSetting.PropertyValue = false.ToString(CultureInfo.InvariantCulture);
childItem.VersionSettings.Add(new ItemVersionSetting(displayOnCurrentPageSetting));
childItem.Save(revisingUser);
count++;
}
return(count);
}