public CheckPromotionConditionResult CheckConditions(Promotion promotion, PriceCalculationContext context)
        {
            var result = new CheckPromotionConditionResult();

            if (!promotion.Conditions.Any())
            {
                result.Success = true;
                foreach (var item in context.Items)
                {
                    result.MatchedItems.Add(item);
                }

                return(result);
            }

            var operators = _ruleEngine.ComparisonOperators.Select(o => o.Name).ToList();

            foreach (var item in context.Items)
            {
                var contextModel = new PromotionConditionContextModel
                {
                    Item     = item,
                    Customer = context.Customer
                };

                if (_ruleEngine.Evaluate(promotion.Conditions, contextModel))
                {
                    result.Success = true;
                    result.MatchedItems.Add(item);
                }
            }

            return(result);
        }
        public CheckPromotionConditionResult CheckConditions(Promotion promotion, PricingContext context)
        {
            var result = new CheckPromotionConditionResult();

            if (!promotion.Conditions.Any())
            {
                result.Success = true;
                foreach (var item in context.Items)
                {
                    result.MatchedItems.Add(item);
                }

                return result;
            }

            var operators = _ruleEngine.ComparisonOperatorManager.Operators.Select(o => o.Name).ToList();

            foreach (var item in context.Items)
            {
                var contextModel = new PromotionConditionContextModel
                {
                    Item = item,
                    Customer = context.Customer
                };

                if (_ruleEngine.CheckConditions(promotion.Conditions, contextModel))
                {
                    result.Success = true;
                    result.MatchedItems.Add(item);
                }
            }

            return result;
        }