Exemple #1
0
        public static bool IsItemInCategory(this PromotionEvaluationContext context, string categoryId, string[] excludingCategoryIds, string[] excludingProductIds)
        {
            var result = new ProductPromoEntry[] { context.PromoEntry }.InCategories(new[] { categoryId })
            .ExcludeCategories(excludingCategoryIds)
            .ExcludeProducts(excludingProductIds)
            .Any();

            return(result);
        }
Exemple #2
0
        public static bool ProductInCategories(this ProductPromoEntry entry, ICollection <string> categoryIds)
        {
            var result = categoryIds.Contains(entry.CategoryId, StringComparer.OrdinalIgnoreCase);

            if (!result && entry.Outline != null)
            {
                result = entry.Outline.Split(';', '/', '\\').Intersect(categoryIds, StringComparer.OrdinalIgnoreCase).Any();
            }
            return(result);
        }
Exemple #3
0
 public static bool ProductInProducts(this ProductPromoEntry entry, IEnumerable <string> productIds)
 {
     return(productIds.Contains(entry.ProductId, StringComparer.OrdinalIgnoreCase));
 }