コード例 #1
0
 private void IncrementRuleAccumulatorForRule(PricingRule rule)
 {
     if (!_ruleAccumulator.ContainsKey(rule.Sku))
     {
         _ruleAccumulator.Add(rule.Sku, 0);
     }
     _ruleAccumulator[rule.Sku]++;
 }
コード例 #2
0
 private void MonitorAndApplyRule(PricingRule rule, ReceiptItems receiptItems)
 {
     IncrementRuleAccumulatorForRule(rule);
     if (_ruleAccumulator[rule.Sku] < rule.QuailfyingQty)
     {
         return;
     }
     ApplyRule(rule, receiptItems);
 }
コード例 #3
0
 private void ResetRuleAccumulatorForRule(PricingRule rule)
 {
     _ruleAccumulator.Remove(rule.Sku);
 }
コード例 #4
0
 private void ApplyRule(PricingRule rule, ReceiptItems receiptItems)
 {
     receiptItems.AddReceiptDiscount(rule.Sku, rule.DiscountRule, rule.Price, rule.Rule);
     ResetRuleAccumulatorForRule(rule);
 }