本文整理汇总了C#中Rock.Model.CategoryService.Where方法的典型用法代码示例。如果您正苦于以下问题:C# CategoryService.Where方法的具体用法?C# CategoryService.Where怎么用?C# CategoryService.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.CategoryService
的用法示例。
在下文中一共展示了CategoryService.Where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUnorderedCategories
private IQueryable<Category> GetUnorderedCategories()
{
string selectedValue = rFilter.GetUserPreference( "EntityType" );
var attributeEntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Attribute ) ).Id;
var queryable = new CategoryService( new RockContext() ).Queryable()
.Where( c => c.EntityTypeId == attributeEntityTypeId );
if ( !string.IsNullOrWhiteSpace( selectedValue ) )
{
if ( selectedValue == "0" )
{
queryable = queryable
.Where( c =>
c.EntityTypeQualifierColumn == "EntityTypeId" &&
c.EntityTypeQualifierValue == null );
}
else
{
queryable = queryable
.Where( c =>
c.EntityTypeQualifierColumn == "EntityTypeId" &&
c.EntityTypeQualifierValue == selectedValue );
}
}
return queryable;
}
示例2: GetUnorderedCategories
private IQueryable<Category> GetUnorderedCategories()
{
var queryable = new CategoryService().Queryable().Where( c => c.EntityTypeId == _entityTypeId );
if (_parentCategoryId.HasValue)
{
queryable = queryable.Where( c => c.ParentCategoryId == _parentCategoryId );
}
else
{
queryable = queryable.Where( c => c.ParentCategoryId == null );
}
return queryable;
}
示例3: GetUnorderedCategories
private IQueryable<Category> GetUnorderedCategories( RockContext rockContext = null )
{
rockContext = rockContext ?? new RockContext();
string selectedValue = rFilter.GetUserPreference( "EntityType" );
var attributeEntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Attribute ) ).Id;
var queryable = new CategoryService( rockContext ).Queryable()
.Where( c =>
c.EntityTypeId == attributeEntityTypeId &&
c.EntityTypeQualifierColumn == "EntityTypeId" );
if ( !string.IsNullOrWhiteSpace( selectedValue ) )
{
if ( selectedValue == "0" )
{
queryable = queryable.Where( c => c.EntityTypeQualifierValue == null );
}
else
{
queryable = queryable.Where( c => c.EntityTypeQualifierValue == selectedValue );
}
}
else
{
// Exclude the categories for block and service job attributes, since they are controlled through code attribute decorations
var exclusions = new List<Guid>();
exclusions.Add( Rock.SystemGuid.EntityType.BLOCK.AsGuid() );
exclusions.Add( Rock.SystemGuid.EntityType.SERVICE_JOB.AsGuid() );
var entities = new EntityTypeService( rockContext ).GetEntities()
.Where( t => !exclusions.Contains( t.Guid ) )
.Select( e => e.Id )
.ToList()
.Select( e => e.ToString() )
.ToList();
queryable = queryable.Where( c => entities.Contains( c.EntityTypeQualifierValue ) );
}
return queryable;
}
示例4: GetUnorderedCategories
private IEnumerable<Category> GetUnorderedCategories( RockContext rockContext = null )
{
rockContext = rockContext ?? new RockContext();
var queryable = new CategoryService( rockContext )
.Queryable()
.Where( c => c.EntityTypeId == _entityTypeId )
.ToList()
.Where( c =>
( c.EntityTypeQualifierColumn ?? "" ) == ( _entityCol ?? "" ) &&
( c.EntityTypeQualifierValue ?? "" ) == ( _entityVal ?? "" ) );
if (_parentCategoryId.HasValue)
{
queryable = queryable.Where( c => c.ParentCategoryId == _parentCategoryId );
}
else
{
queryable = queryable.Where( c => c.ParentCategoryId == null );
}
return queryable;
}
示例5: GetUnorderedCategories
private IQueryable<Category> GetUnorderedCategories( int? entityTypeId, RockContext rockContext = null )
{
rockContext = rockContext ?? new RockContext();
var attributeEntityTypeId = EntityTypeCache.Read( typeof( Rock.Model.Attribute ) ).Id;
var queryable = new CategoryService( rockContext ).Queryable()
.Where( c =>
c.EntityTypeId == attributeEntityTypeId &&
c.EntityTypeQualifierColumn == "EntityTypeId" );
if ( entityTypeId.HasValue )
{
var stringValue = entityTypeId.Value.ToString();
queryable = queryable.Where( c =>
( entityTypeId.Value == 0 && c.EntityTypeQualifierValue == null ) ||
( entityTypeId.Value != 0 && c.EntityTypeQualifierValue != null && c.EntityTypeQualifierValue == stringValue ) );
}
else
{
// Exclude the categories for block and service job attributes, since they are controlled through code attribute decorations
var exclusions = new List<Guid>();
exclusions.Add( Rock.SystemGuid.EntityType.BLOCK.AsGuid() );
exclusions.Add( Rock.SystemGuid.EntityType.SERVICE_JOB.AsGuid() );
var entities = new EntityTypeService( rockContext ).GetEntities()
.Where( t => !exclusions.Contains( t.Guid ) )
.Select( e => e.Id )
.ToList()
.Select( e => e.ToString() )
.ToList();
queryable = queryable.Where( c =>
c.EntityTypeQualifierValue == null ||
entities.Contains( c.EntityTypeQualifierValue ) );
}
return queryable;
}
示例6: GetUnorderedCategories
private IEnumerable<Category> GetUnorderedCategories( RockContext rockContext = null )
{
rockContext = rockContext ?? new RockContext();
var queryable = new CategoryService( rockContext )
.Queryable();
if ( _hasEntityTypeBlockSetting )
{
queryable = queryable.Where(c => c.EntityTypeId == _entityTypeId );
}
else
{
int? filterEntityTypeId = entityTypeFilter.SelectedValueAsInt();
if ( filterEntityTypeId.HasValue )
{
queryable = queryable.Where( c => c.EntityTypeId == filterEntityTypeId.Value );
}
}
var queryableFiltered = queryable.ToList()
.Where( c =>
( c.EntityTypeQualifierColumn ?? "" ) == ( _entityCol ?? "" ) &&
( c.EntityTypeQualifierValue ?? "" ) == ( _entityVal ?? "" ) );
if (_parentCategoryId.HasValue)
{
queryableFiltered = queryableFiltered.Where( c => c.ParentCategoryId == _parentCategoryId );
}
else
{
queryableFiltered = queryableFiltered.Where( c => c.ParentCategoryId == null );
}
return queryableFiltered;
}