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


C# CategoryService.Where方法代码示例

本文整理汇总了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;
        }
开发者ID:Ganon11,项目名称:Rock,代码行数:28,代码来源:AttributeCategories.ascx.cs

示例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;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:14,代码来源:Categories.ascx.cs

示例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;
        }
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:42,代码来源:AttributeCategories.ascx.cs

示例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;
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:23,代码来源:Categories.ascx.cs

示例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;
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:38,代码来源:AttributeCategories.ascx.cs

示例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;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:36,代码来源:Categories.ascx.cs


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