本文整理汇总了C#中TripThruCore.PartnerTrip.UpdateTripStatus方法的典型用法代码示例。如果您正苦于以下问题:C# PartnerTrip.UpdateTripStatus方法的具体用法?C# PartnerTrip.UpdateTripStatus怎么用?C# PartnerTrip.UpdateTripStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TripThruCore.PartnerTrip
的用法示例。
在下文中一共展示了PartnerTrip.UpdateTripStatus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeTripPickedUp
private void MakeTripPickedUp(PartnerTrip trip)
{
Logger.Log("Picking up: " + trip);
Logger.Tab();
DateTime eta = UpdateDriverRouteAndGetETA(trip.driver, trip.dropoffLocation);
trip.UpdateTripStatus(notifyPartner: true, status: Status.PickedUp, driverLocation: trip.driver.location, eta: eta);
Logger.Untab();
}
示例2: MakeTripComplete
private void MakeTripComplete(PartnerTrip t)
{
Logger.Log("The destination has been reached for: " + t);
Logger.Tab();
t.dropoffTime = DateTime.UtcNow;
CompleteTrip(t);
t.UpdateTripStatus(notifyPartner: true, status: Status.Complete);
Logger.Untab();
}
示例3: MakeTripEnroute
private void MakeTripEnroute(PartnerTrip trip)
{
Logger.Log("Driver is now enroute: " + trip);
Logger.Tab();
DateTime eta = UpdateDriverRouteAndGetETA(trip.driver, trip.pickupLocation);
trip.UpdateTripStatus(notifyPartner: true, status: Status.Enroute, driverLocation: trip.driver.location, eta: eta);
Logger.Untab();
}
示例4: CancelTrip
private static void CancelTrip(PartnerTrip t)
{
Logger.Log("Missed period reached: -- so cancel " + t);
Logger.Tab();
t.UpdateTripStatus(notifyPartner: true, status: Status.Cancelled);
Logger.Untab();
}
示例5: TryDispatchTripLocally
public bool TryDispatchTripLocally(PartnerTrip t)
{
Logger.Log("DispatchTripLocally");
if (!FleetServesLocation(t.pickupLocation))
{
Logger.Log("Pickup location " + t.pickupLocation + " is outside of coverage area");
return false;
}
if (t.status != Status.Queued)
throw new Exception("Invalid 'Dispatch' status");
if (ThereAreAvailableDrivers())
{
DispatchToFirstAvailableDriver(t);
t.UpdateTripStatus(notifyPartner: true, status: Status.Dispatched, driverLocation: t.driver.location, eta: t.pickupTime);
return true;
}
Logger.Log("No drivers are currently available");
return false;
}
示例6: QueueTrip
public bool QueueTrip(PartnerTrip t)
{
lock (locker)
{
if (availableDrivers.Count == 0 && t.origination == PartnerTrip.Origination.Foreign)
return false; // don't except from parters if no available drivers
Logger.Log("Queueing " + t);
queue.AddLast(t);
partner.tripsByID.Add(t.ID, t);
partner.activeTrips.Add(t.ID, new Trip
{
FleetId = t.PartnerFleet != null ? t.PartnerFleet.ID : null,
FleetName = t.PartnerFleet != null ? t.PartnerFleet.name : null,
DriverId = t.driver != null ? t.driver.ID : null,
DriverLocation = t.driver != null ? t.driver.location : null,
DriverName = t.driver != null ? t.driver.name : null,
DropoffLocation = t.dropoffLocation,
DriverInitiaLocation = null,
DropoffTime = t.dropoffTime,
Id = t.ID,
OriginatingPartnerId = this.ID,
OriginatingPartnerName = this.name,
PassengerName = t.passengerName,
PickupLocation = t.pickupLocation,
PickupTime = t.pickupTime,
Price = t.price,
Status = t.status,
VehicleType = t.vehicleType,
});
t.UpdateTripStatus(notifyPartner: false, status: Status.Queued);
return true;
}
}
示例7: GetTripStatusFromForeignServiceProvider
// speed is miles per hour
public void GetTripStatusFromForeignServiceProvider(PartnerTrip trip, bool force = false)
{
if (force || DateTime.UtcNow > trip.lastUpdate + updateInterval && trip.status != Status.Complete)
{
Logger.Log("Getting (Foreign) status of " + trip);
Logger.Tab();
Gateway.GetTripStatusRequest request = new Gateway.GetTripStatusRequest(clientID: ID, tripID: trip.ID);
Gateway.GetTripStatusResponse response = tripthru.GetTripStatus(request);
if (response.status != null)
trip.UpdateTripStatus(notifyPartner: false, status: (Status)response.status, driverLocation: response.driverLocation, eta: response.ETA); // todo: not good -- fix this.
if (response.driverName != null)
trip.driver = new Driver(name: response.driverName, location: response.driverLocation);
if (response.dropoffTime != null)
trip.dropoffTime = response.dropoffTime;
if (response.vehicleType != null)
trip.vehicleType = response.vehicleType;
if (response.distance != null)
trip.distance = response.distance;
Logger.Untab();
trip.lastUpdate = DateTime.UtcNow;
}
}
示例8: QueueTrip
public bool QueueTrip(PartnerTrip t)
{
lock (locker)
{
if (availableDrivers.Count == 0 && t.origination == PartnerTrip.Origination.Foreign)
return false; // don't except from parters if no available drivers
Logger.Log("Queueing " + t);
queue.AddLast(t);
if (partner.activeTrips.ContainsKey(t.ID))
throw new Exception("Trip " + t + ": already exist in activeTrips dictionary -- Existing trip = " + partner.activeTrips[t.ID]);
if (partner.tripsByID.ContainsKey(t.ID))
throw new Exception("Trip " + t + ": already exist in tripsByID dictionary");
partner.tripsByID.Add(t.ID, t);
partner.activeTrips.Add(t.ID, new Trip
{
FleetId = t.PartnerFleet != null ? t.PartnerFleet.ID : null,
FleetName = t.PartnerFleet != null ? t.PartnerFleet.name : null,
DriverId = t.driver != null ? t.driver.ID : null,
DriverLocation = t.driver != null ? t.driver.location : null,
DriverName = t.driver != null ? t.driver.name : null,
DropoffLocation = t.dropoffLocation,
DriverInitiaLocation = t.driverInitiaLocation ?? null,
DropoffTime = t.dropoffTime,
Id = t.ID,
OriginatingPartnerId = this.ID,
OriginatingPartnerName = this.name,
PassengerName = t.passengerName,
PickupLocation = t.pickupLocation,
PickupTime = t.pickupTime,
Price = t.price,
Status = t.status,
VehicleType = t.vehicleType,
SamplingPercentage = 1
});
t.UpdateTripStatus(notifyPartner: false, status: Status.Queued);
return true;
}
}