public CashContext(string type) { switch (type) { case "正常收费": _cs = new CashNormal(); break; case "满300返100": _cs = new CashReturn(300, 100); break; case "打8折": //csRtn = new CashRebate(0.8); CashRebate cr = new CashRebate(0.8); _cs = cr; break; } }
public CashContext(string type) { switch (type) { case "正常收费": _cs = new CashNormal(); break; case "满300返100": _cs = new CashReturn(300, 100); break; case "打8折": //csRtn = new CashRebate(0.8); CashRebate cr = new CashRebate(0.8); _cs = cr; break; } }
public static CashSuper CreateCashAccept(string type) { CashSuper cs = null; switch (type) { case "Normal": cs = new CashNormal(); break; case "300-100": cs = new CashReturn("300", "100"); break; case "0.8": cs = new CashRebate("0.8"); break; } return(cs); }
/// <summary> /// 通过string type获取某一种活动的对象. /// </summary> /// <param name="type"></param> /// <returns></returns> public static CashSuper createCashAccept(string type) { CashSuper csRtn = null; switch (type) { case "正常收费": csRtn = new CashNormal(); break; case "满300返100": csRtn = new CashReturn(300, 100); break; case "打8折": //csRtn = new CashRebate(0.8); CashRebate cr = new CashRebate(0.8); csRtn = cr; break; } return(csRtn); }
public CashContext(CashSuper cashSuper) { cs = cashSuper; }