Esempio n. 1
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        private void BindGrid()
        {
            int                 cacheTagDefinedTypeId = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.CACHE_TAGS).Id;
            RockContext         rockContext           = new RockContext();
            DefinedValueService definedValueService   = new DefinedValueService(rockContext);
            var                 cacheTags             = definedValueService.Queryable().Where(v => v.DefinedTypeId == cacheTagDefinedTypeId).ToList();

            var gridData = new List <CacheTagGridRow>();

            foreach (var tag in cacheTags)
            {
                // do something here to get linked keys count
                long linkedKeys = RockCache.GetCountOfCachedItemsForTag(tag.Value);
                var  row        = new CacheTagGridRow
                {
                    TagName        = tag.Value,
                    TagDescription = tag.Description,
                    LinkedKeys     = linkedKeys,
                    DefinedValueId = tag.Id
                };

                gridData.Add(row);
            }

            gCacheTagList.DataSource = gridData;
            gCacheTagList.DataBind();
        }