本文整理汇总了C#中Rock.Model.CategoryService.All方法的典型用法代码示例。如果您正苦于以下问题:C# CategoryService.All方法的具体用法?C# CategoryService.All怎么用?C# CategoryService.All使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.CategoryService
的用法示例。
在下文中一共展示了CategoryService.All方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowSettings
/// <summary>
/// Shows the settings.
/// </summary>
protected override void ShowSettings()
{
mdCategoryTreeConfig.Visible = true;
var entityType = EntityTypeCache.Read( this.GetAttributeValue( "EntityType" ).AsGuid() );
var rootCategory = new CategoryService( new RockContext() ).Get( this.GetAttributeValue( "RootCategory" ).AsGuid() );
cpRootCategory.EntityTypeId = entityType != null ? entityType.Id : 0;
// make sure the rootCategory matches the EntityTypeId (just in case they changed the EntityType after setting RootCategory
if ( rootCategory != null && cpRootCategory.EntityTypeId == rootCategory.EntityTypeId )
{
cpRootCategory.SetValue( rootCategory );
}
else
{
cpRootCategory.SetValue( null );
}
cpRootCategory.Enabled = entityType != null;
nbRootCategoryEntityTypeWarning.Visible = entityType == null;
var excludedCategories = new CategoryService( new RockContext() ).GetByGuids( this.GetAttributeValue( "ExcludeCategories" ).SplitDelimitedValues().AsGuidList() );
cpExcludeCategories.EntityTypeId = entityType != null ? entityType.Id : 0;
// make sure the excluded categories matches the EntityTypeId (just in case they changed the EntityType after setting excluded categories
if ( excludedCategories != null && excludedCategories.All( a => a.EntityTypeId == cpExcludeCategories.EntityTypeId) )
{
cpExcludeCategories.SetValues( excludedCategories );
}
else
{
cpExcludeCategories.SetValue( null );
}
mdCategoryTreeConfig.Show();
}