/// <summary> /// Gets the catalog association dto by entry id. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> /// <returns></returns> internal static CatalogAssociationDto GetCatalogAssociationDtoByEntryId(int catalogEntryId) { // Assign new cache key, specific for site guid and response groups requested string cacheKey = CatalogCache.CreateCacheKey("catalogassociation-catalogEntryId-", catalogEntryId.ToString()); CatalogAssociationDto dto = null; // check cache first object cachedObject = CatalogCache.Get(cacheKey); if (cachedObject != null) { dto = (CatalogAssociationDto)cachedObject; } // Load the object if (dto == null) { CatalogAssociationAdmin admin = new CatalogAssociationAdmin(); admin.LoadByCatalogEntryId(catalogEntryId); dto = admin.CurrentDto; // Insert to the cache collection CatalogCache.Insert(cacheKey, dto, CatalogConfiguration.Instance.Cache.CatalogCollectionTimeout); } dto.AcceptChanges(); return(dto); }
/// <summary> /// Saves the catalog association type. /// </summary> /// <param name="dto">The dto.</param> internal static void SaveAssociationType(CatalogAssociationDto dto) { if (dto == null) { throw new ArgumentNullException("dto", String.Format("CatalogAssociationDto can not be null")); } CatalogAssociationAdmin admin = new CatalogAssociationAdmin(dto); admin.SaveAssociationType(); }
/// <summary> /// Saves the catalog association. /// </summary> /// <param name="dto">The dto.</param> internal static void SaveCatalogAssociation(CatalogAssociationDto dto) { if (dto == null) { throw new ArgumentNullException("dto", String.Format("CatalogAssociationDto can not be null")); } CatalogAssociationAdmin admin = new CatalogAssociationAdmin(dto); EventContext.Instance.RaiseAssociationUpdatingEvent(dto, new AssociationEventArgs("updating")); admin.Save(); EventContext.Instance.RaiseAssociationUpdatedEvent(dto, new AssociationEventArgs("updated")); }