/// <summary>
        /// Binds the filter.
        /// </summary>
        private void BindFilter()
        {
            // 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 rockContext = new RockContext();
            var entityTypes = new EntityTypeService(rockContext).GetEntities()
                              .Where(t => !exclusions.Contains(t.Guid))
                              .OrderBy(t => t.FriendlyName)
                              .ToList();

            entityTypePicker.EntityTypes = entityTypes;

            // Load Entity Type Filter
            var attributeEntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.Attribute)).Id;
            var categoryEntities      = new CategoryService(rockContext).Queryable()
                                        .Where(c =>
                                               c.EntityTypeId == attributeEntityTypeId &&
                                               c.EntityTypeQualifierColumn == "EntityTypeId" &&
                                               c.EntityTypeQualifierValue != null)
                                        .Select(c => c.EntityTypeQualifierValue)
                                        .ToList()
                                        .Select(c => c.AsInteger());

            entityTypeFilter.EntityTypes = entityTypes.Where(e => categoryEntities.Contains(e.Id)).ToList();
            entityTypeFilter.SetValue(rFilter.GetUserPreference("EntityType"));
        }
        /// <summary>
        /// Loads the entities.
        /// </summary>
        private void LoadEntities()
        {
            using (RockContext rockContext = new RockContext()) {
                var entities = new EntityTypeService(rockContext).Queryable().AsNoTracking().ToList();

                var indexableEntities = entities.Where(e => e.IsIndexingSupported == true).ToList();

                gEntityList.DataSource = indexableEntities;
                gEntityList.DataBind();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Binds the filter.
        /// </summary>
        private void BindFilter()
        {
            var rockContext = new RockContext();
            var entityTypes = new EntityTypeService(rockContext).GetEntities()
                              .OrderBy(t => t.FriendlyName)
                              .ToList();

            entityTypePicker.EntityTypes = entityTypes;

            // Load Entity Type Filter
            var noteTypeEntities = new NoteTypeService(rockContext).Queryable()
                                   .Select(c => c.EntityTypeId)
                                   .Distinct()
                                   .ToList();

            entityTypeFilter.EntityTypes = entityTypes.Where(e => noteTypeEntities.Contains(e.Id)).ToList();
            entityTypeFilter.SetValue(rFilter.GetUserPreference("EntityType"));
        }