コード例 #1
0
ファイル: CashContext.cs プロジェクト: skmygdrs/jgy_code
 //根据条件返回相应的对象
 public CashContext(string type)
 {
     switch (type)
     {
     case "正常收费":
         CashNormal cs0 = new CashNormal();
         cs = cs0;
         break;
     case "满300返100":
         CashReturn cr1 = new CashReturn("300", "100");
         cs = cr1;
         break;
     case "打8折":
         CashRebate cr2 = new CashRebate("0.8");
         cs = cr2;
         break;
     }
 }
コード例 #2
0
        //根据条件返回相应的对象
        public CashContext(string type)
        {
            switch (type)
            {
            case "正常收费":
                CashNormal cs0 = new CashNormal();
                cs = cs0;
                break;

            case "满300返100":
                CashReturn cr1 = new CashReturn("300", "100");
                cs = cr1;
                break;

            case "打8折":
                CashRebate cr2 = new CashRebate("0.8");
                cs = cr2;
                break;
            }
        }
コード例 #3
0
        public static CashSuper createCashAccept(string type)
        {
            CashSuper cs = null;

            switch (type)
            {
            case "正常收费":
                cs = new CashNormal();
                break;

            case "满300返100":
                CashReturn cr1 = new CashReturn("300", "100");
                break;

            case "打八折":
                CashRebate cr2 = new CashRebate("0.8");
                cs = cr2;
                break;
            }
            return(cs);
        }
コード例 #4
0
 //设置策略行为,参数为具体的现金收费子类(正常,打折或返利)
 public CashContext(CashSuper csuper)
 {
     this.cs = csuper;
 }
コード例 #5
0
ファイル: CashContext.cs プロジェクト: skmygdrs/jgy_code
 public void setBehavior(CashSuper csuper)
 {
     this.cs = csuper;
 }
コード例 #6
0
 public void setBehavior(CashSuper csuper)
 {
     this.cs = csuper;
 }
コード例 #7
0
ファイル: CashContext.cs プロジェクト: skmygdrs/jgy_code
 //设置策略行为,参数为具体的现金收费子类(正常,打折或返利)
 public CashContext(CashSuper csuper)
 {
     this.cs = csuper;
 }
コード例 #8
0
 public void setBehavior(string className, object[] args)
 {
     this.cs = (CashSuper)Assembly.Load("商场管理软件").CreateInstance("商场管理软件." + className, false, BindingFlags.Default, null, args, null, null);
 }