コード例 #1
0
        /// <summary>
        /// Builds the filter controls.
        /// </summary>
        private void BuildControls()
        {
            var query      = new AttributeService(new RockContext()).Get(_blockTypeEntityId, "Id", _block.Id.ToString());
            var attributes = query.OrderBy(a => a.Order).ToList();

            var exclusions = new List <string>();

            exclusions.Add(AttributeKey.RedirectPage);

            _block.LoadAttributes();
            phAttributes.Controls.Clear();

            var attributeKeys = new List <string>();

            foreach (var attribute in attributes)
            {
                if (attribute.IsAuthorized(Authorization.VIEW, CurrentPerson))
                {
                    attributeKeys.Add(attribute.Key);
                }
            }

            try
            {
                Helper.AddEditControls("", attributeKeys, _block, phAttributes, "", false, exclusions, _filtersPerRow);
            }
            catch
            {
                pnlFilters.Visible    = false;
                nbBuildErrors.Visible = true;
                nbBuildErrors.Text    = "Not all filter controls could be built. The most likely cause of this issue is a mis-configured filter.";
            }
        }
コード例 #2
0
        /// <summary>
        /// Builds the filter controls.
        /// </summary>
        private void BuildControls()
        {
            var query      = new AttributeService(new RockContext()).Get(_blockTypeEntityId, "Id", _block.Id.ToString());
            var attributes = query.OrderBy(a => a.Order).ToList();

            var exclusions = new List <string>();

            exclusions.Add(AttributeKey.RedirectPage);

            _block.LoadAttributes();
            phAttributes.Controls.Clear();

            var attributeKeys = new List <string>();

            foreach (var attribute in attributes)
            {
                if (attribute.IsAuthorized(Authorization.VIEW, CurrentPerson))
                {
                    attributeKeys.Add(attribute.Key);
                }
            }

            Helper.AddEditControls("", attributeKeys, _block, phAttributes, "", false, exclusions, _filtersPerRow);
        }
コード例 #3
0
        /// <summary>
        /// Binds the grid for type attributes.
        /// </summary>
        /// <param name="typeId">The type id.</param>
        protected void rGridAttribute_Bind(string typeId)
        {
            var queryable = new AttributeService().Queryable().
                            Where(a => a.EntityTypeId == _entityTypeId &&
                                  (a.EntityTypeQualifierColumn ?? string.Empty) == _entityQualifier &&
                                  (a.EntityTypeQualifierValue ?? string.Empty) == typeId);

            SortProperty sortProperty = rGridAttribute.SortProperty;

            if (sortProperty != null)
            {
                queryable = queryable.
                            Sort(sortProperty);
            }
            else
            {
                queryable = queryable.
                            OrderBy(a => a.Category).
                            ThenBy(a => a.Key);
            }

            rGridAttribute.DataSource = queryable.ToList();
            rGridAttribute.DataBind();
        }