/// <summary>
        /// Handles the Save filters event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void mdFilter_SaveClick(object sender, EventArgs e)
        {
            Rock.Model.Attribute attribute = null;

            // Sets the attribute to use the "CustomSetting" attribute
            var entityTypeId = EntityTypeCache.Get(Rock.SystemGuid.EntityType.ATTRIBUTE).Id;
            var entityId     = EntityTypeCache.Get(Rock.SystemGuid.EntityType.BLOCK).Id;

            edtFilter.CategoryIds = CategoryCache.All()
                                    .Where(c =>
                                           c.Name == "CustomSetting" &&
                                           c.EntityTypeId == entityTypeId &&
                                           c.EntityTypeQualifierColumn == "EntityTypeId" &&
                                           c.EntityTypeQualifierValue == entityId.ToString())
                                    .Select(c => c.Id);

            // ISSUE JME - When adding a new attribute the edtFilter does not load here with it's default value setting.
            // currently you need to add the attribute then edit it again to add a default value.
            attribute = Helper.SaveAttributeEdits(edtFilter, _blockTypeEntityId, "Id", _block.Id.ToString());

            // Attribute will be null if it was not valid
            if (attribute == null)
            {
                return;
            }

            mdFilter.Hide();
            BindGrid();
        }
Exemplo n.º 2
0
        public static List <PersonCourseInfo> PersonCourseInfo(DotLiquid.Context context, object personObj, string categoryIds)
        {
            if (personObj != null && personObj is Person)
            {
                var courseEntityType = EntityTypeCache.Get(typeof(Course));
                var validCategoryIds = CategoryCache.All()
                                       .Where(c => c.EntityTypeId == courseEntityType.Id)
                                       .Where(c => categoryIds.Split().Select(i => i.AsInteger()).ToList().Contains(c.Id))
                                       .Select(c => c.Id).ToList();

                return(PersonCourseInfo(context, personObj as Person, validCategoryIds));
            }

            return(null);
        }
Exemplo n.º 3
0
        public static List <PersonCourseInfo> PersonCourseInfo(DotLiquid.Context context, object personObj)
        {
            var courseEntityType = EntityTypeCache.Get(typeof(Course));
            var categories       = CategoryCache.All().Where(c => c.EntityTypeId == courseEntityType.Id);
            var categoryIds      = categories
                                   .Select(c => c.Id)
                                   .ToList();

            if (personObj != null && personObj is Person)
            {
                return(PersonCourseInfo(context, personObj as Person, categoryIds));
            }

            return(null);
        }