Esempio n. 1
0
 public IRebate GetRebator(RebateBaseInfo baseInfo)
 {
     switch (baseInfo.ByNumStrategyType)
     {
         case RebateByNumStrategy.Simple:
             return new SimpleRebateByNum(baseInfo.RebateAmount);
         case RebateByNumStrategy.Condition:
             return new ConditionRebateByNum(baseInfo.RebateAmount);
         default:
             return null;
     }
 }
Esempio n. 2
0
 public static IRebate GetRebator(RebateBaseInfo baseInfo)
 {
     switch (baseInfo.Type)
     {
         case RebateType.ByAmount:
             var rebateByAmtContext = new RebateByAmtContext();
             return rebateByAmtContext.GetRebator(baseInfo);
         case RebateType.ByNumber:
             var rebateByNumContext = new RebateByNumContext();
             return rebateByNumContext.GetRebator(baseInfo);
         default:
             return null;
     }
 }
Esempio n. 3
0
 static void Main(string[] args)
 {
     //这里mock数据
     RebateBaseInfo baseInfo = new RebateBaseInfo() 
     {
         GoodsNumber = 1,
         RebateAmount = 5.86m,
         Type = RebateType.ByNumber,
         ByNumStrategyType = RebateByNumStrategy.Simple
     };
     IRebate rebator = RebateFactory.GetRebator(baseInfo);
     Console.Write(rebator.GetRebateAmt(baseInfo));
     Console.Read();
 }
Esempio n. 4
0
 public abstract decimal GetRebateAmt(RebateBaseInfo rebateBaseInfo);
Esempio n. 5
0
 public override decimal GetRebateAmt(RebateBaseInfo rebateBaseInfo)
 {
     return rebateBaseInfo.GoodsNumber * Amount;
 }
Esempio n. 6
0
 public override decimal GetRebateAmt(RebateBaseInfo rebateBaseInfo)
 {
     return rebateBaseInfo.Amount * Percent;
 }