示例#1
0
        /// <summary>
        /// Gets the Promotion dto without caching the results.
        /// </summary>
        /// <param name="promotionId">The promotion id.</param>
        /// <returns></returns>
        public static PromotionDto GetPromotionDto(int promotionId)
        {
            // Assign new cache key, specific for site guid and response groups requested
            //string cacheKey = MarketingCache.CreateCacheKey("Promotion", PromotionId.ToString());

            PromotionDto dto = null;

            // check cache first
            //object cachedObject = MarketingCache.Get(cacheKey);

            //if (cachedObject != null)
            //    dto = (PromotionDto)cachedObject;

            // Load the object
            if (dto == null)
            {
                PromotionAdmin admin = new PromotionAdmin();
                admin.Load(promotionId);
                dto = admin.CurrentDto;

                // Insert to the cache collection
                //MarketingCache.Insert(cacheKey, dto, MarketingConfiguration.CacheConfig.PromotionCollectionTimeout);
            }

            return(dto);
        }
示例#2
0
        /// <summary>
        /// Gets promotion dto based on the date passed. Only promotions that are active for the period specified (plus 1 week) will be returned.
        /// </summary>
        /// <param name="dateTime">The date time.</param>
        /// <returns></returns>
        public static PromotionDto GetPromotionDto(DateTime dateTime)
        {
            PromotionAdmin admin = new PromotionAdmin();

            admin.Load(dateTime);
            return(admin.CurrentDto);
        }