/// <summary> /// Gets the Expression dto, checks permissions and caches results. /// </summary> /// <param name="expressionId">The expression id.</param> /// <returns></returns> public static ExpressionDto GetExpressionDto(int expressionId) { // Assign new cache key, specific for site guid and response groups requested //string cacheKey = MarketingCache.CreateCacheKey("Expression", ExpressionId.ToString()); ExpressionDto dto = null; // check cache first //object cachedObject = MarketingCache.Get(cacheKey); //if (cachedObject != null) // dto = (ExpressionDto)cachedObject; // Load the object if (dto == null) { ExpressionAdmin Expression = new ExpressionAdmin(); Expression.Load(expressionId); dto = Expression.CurrentDto; // Insert to the cache collection //MarketingCache.Insert(cacheKey, dto, MarketingConfiguration.CacheConfig.ExpressionCollectionTimeout); } dto.AcceptChanges(); return(dto); }
/// <summary> /// Gets the expression dto. /// </summary> /// <param name="segmentId">The segment id.</param> /// <returns></returns> public static ExpressionDto GetExpressionBySegmentDto(int segmentId) { ExpressionDto dto = null; // Load the object if (dto == null) { ExpressionAdmin Expression = new ExpressionAdmin(); Expression.LoadBySegment(segmentId); dto = Expression.CurrentDto; } dto.AcceptChanges(); return(dto); }
/// <summary> /// Gets the ExpressionDto by category. The supported categories now are "Promotion", "Segment", "Policy". /// </summary> /// <param name="category">The category.</param> /// <returns></returns> public static ExpressionDto GetExpressionDto(string category) { ExpressionDto dto = null; // Load the object if (dto == null) { ExpressionAdmin Expression = new ExpressionAdmin(); Expression.LoadByCategory(category); dto = Expression.CurrentDto; } dto.AcceptChanges(); return(dto); }