public static ParkCarDerate QueryBySellerIdAndIORecordId(string sellerId, string ioRecordId) { IParkCarDerate factory = ParkCarDerateFactory.GetFactory(); ParkCarDerate carDerate = factory.QueryBySellerIdAndIORecordId(sellerId, ioRecordId); return(carDerate); }
public static bool QRCodeDiscount(string sellerId, string derateId, string carDerateId, string parkingId, string ioRecordId, string plateNumber) { if (string.IsNullOrWhiteSpace(sellerId)) { throw new ArgumentNullException("sellerId"); } if (string.IsNullOrWhiteSpace(derateId)) { throw new ArgumentNullException("derateId"); } if (string.IsNullOrWhiteSpace(carDerateId)) { throw new ArgumentNullException("carDerateId"); } if (string.IsNullOrWhiteSpace(parkingId)) { throw new ArgumentNullException("parkingId"); } if (string.IsNullOrWhiteSpace(plateNumber)) { throw new ArgumentNullException("plateNumber"); } List <ParkCarDerate> carDerates = ParkCarDerateServices.QueryByDerateId(carDerateId); if (carDerates == null || carDerates.Count == 0) { throw new MyException("该优免券不存在"); } if (!string.IsNullOrWhiteSpace(carDerates.First().PlateNumber)) { throw new MyException("该优免券已使用过了[001]"); } if (carDerates.First().Status == CarDerateStatus.Settlementd) { throw new MyException("该优免券已使用过了[002]"); } if (carDerates.First().Status != CarDerateStatus.Used) { throw new MyException("该优免券不是有效状态"); } IParkCarDerate factory = ParkCarDerateFactory.GetFactory(); ParkCarDerate carDerate = factory.QueryBySellerIdAndIORecordId(sellerId, ioRecordId); if (carDerate != null) { throw new MyException("该车辆已优免了"); } ParkDerate derate = ParkDerateServices.Query(derateId); if (derate == null) { throw new MyException("找不到优免规则"); } ParkSeller seller = ParkSellerServices.QueryBySellerId(derate.SellerID); if (seller == null) { throw new MyException("找不到商家信息"); } return(factory.QRCodeDiscount(carDerateId, parkingId, ioRecordId, plateNumber)); }