日期:2014-05-17 浏览次数:20585 次
class StateJudgeFaction { public static StateJudge CreateStateJudge() { StateJudge sj = null; return sj; } } class StateJudge { protected virtual void IsIsNormal() { //判断状态是否正常代码 } } class StateA : StateJudge { protected override void IsIsNormal() { //判断状态是否正常代码 } } class StateB : StateJudge { protected override void IsIsNormal() { //判断状态是否正常代码 } } class StateC : StateJudge { protected override void IsIsNormal() { //判断状态是否正常代码 } }
class CarFreeRegion { private DateTime startDate;//空闲时间段开始时间 public DateTime StartDate { get { return startDate; } set { startDate = value; } } private DateTime endDate;//空闲时间段结束时间 public DateTime EndDate { get { return endDate; } set { endDate = value; } } private string carPlan;//车牌号码 public string CarPlan { get { return carPlan; } set { carPlan = value; } } private string simNo;//sim编号 public string SimNo { get { return simNo; } set { simNo = value; } } private string canUseModel;//用车方式 public string CanUseModel { get { return canUseModel; } set { canUseModel = value; } } private string useNo;//用车单号 public string UseNo { get { return useNo; } set { useNo = value; } } private string carState;//车辆处理后的状态 public string CarState { get { return carState; } set { carState = value; } } }
class StateJudgeFaction { public static StateJudge CreateStateJudge(CarFreeRegion cfr) { StateJudge sj = null; switch (cfr.CanUseModel) //车辆状态 { case "StateA": sj = new StateA(cfr); break; case "StateB": sj = new StateB(cfr); break; case "StateC": sj = new StateC(cfr); break; default: break; } return sj; } } class StateJudge { CarFreeRegion cfr = null; public StateJudge(CarFreeRegion cfr) { this.cfr = cfr; } protected virtual void IsIsNormal() { //判断状态是否正常代码 //通过炒作cfr对象返回或显示数据 } } class StateA : StateJudge { public StateA(CarFreeRegion cfr) : base(cfr) { } protected override void IsIsNormal() { //判断状态是否正常代码