Exemple #1
0
 public decimal GetTotal( Order order )
 {
     if ( order.GetTotal() > threshold ) {
         decimal temp = order.GetTotal() * discount;
         return order.GetTotal() - temp;
     }
     else
         return order.GetTotal();
 }
Exemple #2
0
        public override IPriceStrategy GetTotal( Order order )
        {
            decimal maxValue = decimal.MaxValue;
            IPriceStrategy strategyToReturn = null;

            foreach ( var item in strategies ) {
                if(item.GetTotal( order ) < maxValue ) {
                    maxValue = item.GetTotal( order );
                    strategyToReturn = item;
                }
            }
            return strategyToReturn;
        }
Exemple #3
0
 public decimal GetTotal( Order order )
 {
     decimal temp = order.GetTotal() * discount;
     return order.GetTotal() - temp;
 }
Exemple #4
0
 public abstract IPriceStrategy GetTotal( Order order );