/// <summary> Adds the entire collection hierarchy under the ALL aggregation object </summary> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> TRUE if successful, otherwise FALSE </returns> /// <remarks> This is postponed until it is needed for the TREE VIEW on the home page, to allow the system to start /// faster, even with a great number of item aggregationPermissions in the hierarchy </remarks> public static Aggregation_Hierarchy Get_Collection_Hierarchy(Custom_Tracer Tracer) { if (Tracer != null) Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Collection_Hierarchy", "Preparing to create the aggregation hierarchy object"); // Get the database table DataSet childInfo = Engine_Database.Get_Aggregation_Hierarchies(Tracer); if (childInfo == null) { if (Tracer != null) Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Collection_Hierarchy", "NULL value returned from database lookup"); return null; } // Build the return value Aggregation_Hierarchy returnValue = new Aggregation_Hierarchy(); // Add all the collections if (Tracer != null) Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Collection_Hierarchy", "Add all the child aggregations to the hierarchy"); add_hierarchy_children(returnValue.Collections, childInfo.Tables[0]); // Add all the institutions if (Tracer != null) Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Collection_Hierarchy", "Add all the institutions to the hierarchy"); add_hierarchy_children(returnValue.Institutions, childInfo.Tables[1]); return returnValue; }
/// <summary> Stores the item aggregation hierarchy to the cache </summary> /// <param name="StoreObject"> Item aggregation object to store for later retrieval </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public void Store_Aggregation_Hierarchy(Aggregation_Hierarchy StoreObject, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("CachedDataManager.Store_Aggregation_Hierarchy", "Entering Store_Item_Aggregation method"); } // If the cache is disabled, just return before even tracing if (settings.Disabled) { if (Tracer != null) Tracer.Add_Trace("CachedDataManager.Store_Aggregation_Hierarchy", "Caching is disabled"); return; } // Determine the key const string KEY = "AGGR_HIERARCHY"; const int LOCAL_EXPIRATION = 15; // Locally cache if this doesn't exceed the limit if (Tracer != null) { Tracer.Add_Trace("CachedDataManager.Store_Aggregation_Hierarchy", "Adding object '" + KEY + "' to the local cache with expiration of " + LOCAL_EXPIRATION + " minute(s)"); } HttpContext.Current.Cache.Insert(KEY, StoreObject, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(LOCAL_EXPIRATION)); }