public static bool Update(ParkFeeRule model) { if (model == null) { throw new ArgumentNullException("model"); } ParkArea parkArea = ParkAreaServices.QueryByRecordId(model.AreaID); if (parkArea == null) { throw new MyException("获取区域信息失败"); } IParkFeeRule factory = ParkFeeRuleFactory.GetFactory(); if (model.IsOffline) { List <ParkFeeRule> models = factory.QueryParkFeeRuleByParkingId(parkArea.PKID); if (models.Exists(p => p.IsOffline == true && p.FeeRuleID != model.FeeRuleID)) { throw new MyException("该车场已存在脱机收费规则了"); } } model.ParkFeeRuleDetails.ForEach(p => { p.RuleDetailID = GuidGenerator.GetGuid().ToString(); p.RuleID = model.FeeRuleID; }); bool result = factory.Update(model); if (result) { OperateLogServices.AddOperateLog <ParkFeeRule>(model, OperateType.Update); } return(result); }
public static List <ParkFeeRule> QueryParkFeeRuleByParkingId(string parkingId) { if (string.IsNullOrWhiteSpace(parkingId)) { throw new ArgumentNullException("parkingId"); } IParkFeeRule factory = ParkFeeRuleFactory.GetFactory(); return(factory.QueryParkFeeRuleByParkingId(parkingId)); }