コード例 #1
0
        public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request)
        {
            Logger.BeginRequest("QuoteTrip sent to " + name, request);
            GatewayService.Quotes quotes = new GatewayService.Quotes
            {
                access_token  = AccessToken,
                PassengerId   = request.passengerID,
                PassengerName = request.passengerName,
                Luggage       = request.luggage,
                Persons       = request.persons,
                PickupLat     = request.pickupLocation.Lat,
                PickupLng     = request.pickupLocation.Lng,
                PickupTime    = request.pickupTime,
                DropoffLat    = request.dropoffLocation == null ? (double?)null : request.dropoffLocation.Lat,
                DropoffLng    = request.dropoffLocation == null ? (double?)null : request.dropoffLocation.Lng,
                PaymentMethod = request.paymentMethod,
                VehicleType   = request.vehicleType,
                MaxPrice      = request.maxPrice,
                MinRating     = request.minRating,
                FleetId       = request.fleetID,
                DriverId      = request.driverID,
            };
            JsonServiceClient client = new JsonServiceClient(RootUrl);

            GatewayService.QuotesResponse resp     = client.Get <GatewayService.QuotesResponse>(quotes);
            Gateway.QuoteTripResponse     response = new Gateway.QuoteTripResponse
            {
                result = resp.ResultCode,
                quotes = resp.Quotes
            };
            Logger.EndRequest(response);
            return(response);
        }
コード例 #2
0
        public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request)
        {
            Uri uri;

            if (!Uri.TryCreate(RootUrl, UriKind.Absolute, out uri))
            {
                return new Gateway.QuoteTripResponse
                       {
                           result = Result.InvalidParameters
                       }
            }
            ;
            Logger.BeginRequest("QuoteTrip sent to " + name, request);
            //Logger.Log("RootURL: " + RootUrl);
            GatewayService.Quotes quotes = new GatewayService.Quotes
            {
                access_token  = AccessToken,
                PassengerId   = request.passengerID,
                PassengerName = request.passengerName,
                Luggage       = request.luggage,
                Persons       = request.persons,
                PickupLat     = request.pickupLocation.Lat,
                PickupLng     = request.pickupLocation.Lng,
                PickupTime    = request.pickupTime,
                DropoffLat    = request.dropoffLocation == null ? (double?)null : request.dropoffLocation.Lat,
                DropoffLng    = request.dropoffLocation == null ? (double?)null : request.dropoffLocation.Lng,
                PaymentMethod = request.paymentMethod,
                VehicleType   = request.vehicleType,
                MaxPrice      = request.maxPrice,
                MinRating     = request.minRating,
                FleetId       = request.fleetID,
                DriverId      = request.driverID,
            };
            JsonServiceClient client = new JsonServiceClient(RootUrl);

            client.Timeout = timeout;
            GatewayService.QuotesResponse resp     = client.Get <GatewayService.QuotesResponse>(quotes);
            Gateway.QuoteTripResponse     response = new Gateway.QuoteTripResponse
            {
                result = resp.ResultCode,
                quotes = resp.Quotes
            };
            Logger.EndRequest(response);
            return(response);
        }