コード例 #1
0
ファイル: TripThruGateway.cs プロジェクト: TripThru/Gateway
        public override Gateway.UpdateTripStatusResponse UpdateTripStatus(Gateway.UpdateTripStatusRequest request)
        {
            Logger.BeginRequest("UpdateTripStatus sent to " + server.name, request);
            UpdateTripStatusResponse response = server.UpdateTripStatus(request);

            Logger.EndRequest(response);
            return(response);
        }
コード例 #2
0
ファイル: TripThruGateway.cs プロジェクト: TripThru/Gateway
        public override Gateway.UpdateTripStatusResponse UpdateTripStatus(Gateway.UpdateTripStatusRequest request)
        {
            Logger.BeginRequest("UpdateTripStatus received from " + gateway.GetName(request.clientID), request);
            UpdateTripStatusResponse response = gateway.UpdateTripStatus(request);

            Logger.EndRequest(response);
            return(response);
        }
コード例 #3
0
 private void NotifyForeignPartner(Status status, Location driverLocation, DateTime? eta)
 {
     Logger.Log("Since trip has foreign dependency, notify partner through TripThru");
     Logger.Tab();
     Gateway.UpdateTripStatusRequest request = new Gateway.UpdateTripStatusRequest(
         clientID: partner.ID,
         tripID: ID,
         status: status,
         driverLocation: driverLocation,
         eta: eta
     );
     partner.tripthru.UpdateTripStatus(request);
     Logger.Untab();
 }
コード例 #4
0
ファイル: TDispatch.cs プロジェクト: TripThru/Gateway
        public void UpdateBooking(string tripID, TDispatchAPI.Booking value)
        {
            Status activeTrip = ConvertTDispatchStatusToTripThruStatus(activeTrips[tripID].status,
                activeTrips[tripID].sub_status);
            Status valueTrip = ConvertTDispatchStatusToTripThruStatus(value.status,
                value.sub_status);

            if (activeTrip == valueTrip)
                return;

            Logger.BeginRequest("TDispatch trip " + tripID + " update", null, tripID);
            string bookingPK = activeTrips[tripID].pk;
            if (value.pk == null)
                value.pk = bookingPK;

            activeTrips[tripID] = value;

            Logger.Log("BookingStatus changed ", value);
            Logger.Log("Notify originating partner through TripThru");
            Logger.Tab();
            Location newLocation = null;

            TDispatchAPI.GetBookingStatusResponse getBookingStatusResponse = api.GetBookingStatus(bookingPK);

            if (getBookingStatusResponse.booking.driver != null)
                if (getBookingStatusResponse.booking.driver.location != null)
                    if (getBookingStatusResponse.booking.driver.location.lat != null)
                        if (getBookingStatusResponse.booking.driver.location.lng != null)
                            newLocation = new Location((double)getBookingStatusResponse.booking.driver.location.lat, (double)getBookingStatusResponse.booking.driver.location.lng);

            Gateway.UpdateTripStatusRequest request = new Gateway.UpdateTripStatusRequest(
                clientID: ID,
                tripID: tripID,
                status: ConvertTDispatchStatusToTripThruStatus(value.status, value.sub_status),
                driverLocation: newLocation);
            tripthru.UpdateTripStatus(request);
            Logger.Untab();
            if (activeTrips[tripID].status == "completed" || activeTrips[tripID].status == "cancelled" ||
                        activeTrips[tripID].status == "rejected" || activeTrips[tripID].status == "missed")
                activeTrips.Remove(tripID);
            Logger.EndRequest(null);
        }
コード例 #5
0
        public void UpdateBooking(string tripID, TDispatchAPI.Booking value)
        {
            if (activeTrips[tripID].status == value.status)
                return;

            Logger.BeginRequest("TDispatch trip " + tripID + " update", null, tripID);
            string bookingPK = activeTrips[tripID].pk;
            if (value.pk == null)
                value.pk = bookingPK;

            activeTrips[tripID] = value;

            Logger.Log("BookingStatus changed ", value);
            Logger.Log("Notify originating partner through TripThru");
            Logger.Tab();
            Gateway.UpdateTripStatusRequest request = new Gateway.UpdateTripStatusRequest(
                clientID: ID,
                tripID: tripID,
                status: ConvertTDispatchStatusToTripThruStatus(value.status, value.sub_status));
            tripthru.UpdateTripStatus(request);
            Logger.Untab();
            if (activeTrips[tripID].status == "completed" || activeTrips[tripID].status == "cancelled" ||
                        activeTrips[tripID].status == "rejected" || activeTrips[tripID].status == "missed")
                activeTrips.Remove(tripID);
            Logger.EndRequest(null);
        }