Example #1
0
        /// <summary>
        /// Returns the value that should be used for sorting, using the most appropriate datatype
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">The value.</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <returns></returns>
        public override object SortValue(System.Web.UI.Control parentControl, string value, Dictionary <string, ConfigurationValue> configurationValues)
        {
            var persistedDatasetGuid = value.AsGuidOrNull();

            if (persistedDatasetGuid.HasValue)
            {
                return(PersistedDatasetCache.Get(persistedDatasetGuid.Value).Name);
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override System.Web.UI.Control EditControl(System.Collections.Generic.Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var ddlPersistedDataset = new RockDropDownList {
                ID = id
            };

            ddlPersistedDataset.Items.Clear();
            ddlPersistedDataset.Items.Add(new ListItem());
            foreach (var persistedDataset in PersistedDatasetCache.All().OrderBy(a => a.Name))
            {
                ddlPersistedDataset.Items.Add(new ListItem(persistedDataset.Name, persistedDataset.Guid.ToString()));
            }

            return(ddlPersistedDataset);
        }
Example #3
0
        /// <summary>
        /// Gets the cached entities as a list.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public List <IEntityCache> GetCachedEntities(string value)
        {
            var result = new List <IEntityCache>();

            List <PersistedDatasetCache> list = value.SplitDelimitedValues().AsGuidList().Select(g => PersistedDatasetCache.Get(g)).ToList();

            result.AddRange(list);

            return(result);
        }
Example #4
0
 /// <summary>
 /// Updates any Cache Objects that are associated with this entity
 /// </summary>
 /// <param name="entityState">State of the entity.</param>
 /// <param name="dbContext">The database context.</param>
 public void UpdateCache(EntityState entityState, Data.DbContext dbContext)
 {
     PersistedDatasetCache.UpdateCachedEntity(this.Id, entityState);
 }
Example #5
0
 /// <summary>
 /// Gets the cache object associated with this Entity
 /// </summary>
 /// <returns></returns>
 public IEntityCache GetCacheObject()
 {
     return(PersistedDatasetCache.Get(this.Id));
 }