当前位置: 首页>>代码示例>>C#>>正文


C# TripThruCore.PartnerTrip类代码示例

本文整理汇总了C#中TripThruCore.PartnerTrip的典型用法代码示例。如果您正苦于以下问题:C# PartnerTrip类的具体用法?C# PartnerTrip怎么用?C# PartnerTrip使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PartnerTrip类属于TripThruCore命名空间,在下文中一共展示了PartnerTrip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_TripLifeCycle_Base

 public Test_TripLifeCycle_Base(
     string filename,
     Gateway tripthru,
     TimeSpan? maxLateness = null,
     PartnerTrip.Origination? origination = null,
     PartnerTrip.Origination? service = null,
     double? locationVerificationTolerance = null)
 {
     this.filename = filename;
     this.tripthru = tripthru;
     if (maxLateness != null)
         this.maxLateness = (TimeSpan)maxLateness;
     if (origination != null)
         this.origination = origination;
     if (service != null)
         this.service = service;
     if (locationVerificationTolerance != null)
         this.locationVerificationTolerance = (double)locationVerificationTolerance;
     PartnerConfiguration configuration = Partner.LoadPartnerConfigurationFromJsonFile(filename);
     partner = new Partner(configuration.Partner.ClientId, configuration.Partner.Name, new GatewayClientMock(tripthru), configuration.partnerFleets);
     partner.tripthru.RegisterPartner(partner);
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:22,代码来源:Test_TripLifeCycle.cs

示例2: GetPrice

 // TODO: make these more real
 public double GetPrice(PartnerTrip trip)
 {
     return baseCost + (GetDistance(trip) * costPerMile); // once we have the distance it won't be too hard to come up with some prices.
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:5,代码来源:1396654558$PartnerGateway.cs

示例3: ProcessStatusEnroute

 private void ProcessStatusEnroute(PartnerTrip t)
 {
     if (TripServicedByForeignProvider(t))
         return; // partner.GetTripStatusFromForeignServiceProvider(t, true);
     else
     {
         UpdateTripDriverLocation(t);
         if (DriverHasReachedThePickupLocation(t))
             MakeTripPickedUp(t);
         else if (TripStatusUpdateIntervalReached(t))
             LogTheNewDriverLocation(t);
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396654558$PartnerGateway.cs

示例4: MissedPeriodReached

 private bool MissedPeriodReached(PartnerTrip t)
 {
     return DateTime.UtcNow > t.pickupTime + missedPeriod;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例5: 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();
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:8,代码来源:1396654558$PartnerGateway.cs

示例6: DispatchTrip

        void DispatchTrip(PartnerTrip t)
        {
            if (TripOriginatedLocally(t))
            {
                if (MissedPeriodReached(t))
                {
                    CancelTrip(t);
                    return;
                }
                if (TripServicedByForeignProvider(t)) // means serviced through partner
                    return;
            }
            // If origination is foreign, then it means we're servicing the trip so we have to process it.
            if (CriticalPeriodNotYetReached(t))
                return;
            Logger.Log("Ready for dispatch: " + t);
            Logger.Tab();

            if (!TryDispatchTripLocally(t) && TripOriginatedLocally(t))
                TryToDispatchToForeignProvider(t);
            Logger.Untab();
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:22,代码来源:1396654558$PartnerGateway.cs

示例7: DispatchRetryIntervalReached

 private bool DispatchRetryIntervalReached(PartnerTrip t)
 {
     return DateTime.UtcNow > t.lastDispatchAttempt + retryInterval;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例8: UpdateTripDriverLocation

 private static void UpdateTripDriverLocation(PartnerTrip t)
 {
     t.driver.location = t.driver.route.GetCurrentWaypoint(t.driver.routeStartTime, DateTime.UtcNow);
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例9: 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();
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396654558$PartnerGateway.cs

示例10: AgeSinceCompletedClock_HasNotBeenSet

 private static bool AgeSinceCompletedClock_HasNotBeenSet(PartnerTrip t)
 {
     return t.dropoffTime == null;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例11: 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;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:19,代码来源:1396654558$PartnerGateway.cs

示例12: TripStatusUpdateIntervalReached

 public bool TripStatusUpdateIntervalReached(PartnerTrip t)
 {
     return DateTime.UtcNow > t.lastUpdate + updateInterval;
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例13: RemoveTrip

 public void RemoveTrip(PartnerTrip t)
 {
     queue.Remove(queue.Find(t));
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:4,代码来源:1396654558$PartnerGateway.cs

示例14: 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;
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:33,代码来源:1396654558$PartnerGateway.cs

示例15: ProcessTrip

 public void ProcessTrip(PartnerTrip t)
 {
     //Logger.LogDebug("Processing " + t);
     lock (locker)
     {
         switch (t.status)
         {
             case Status.New:
                 {
                     Logger.Log("Unexpected status (New): Something wrong with " + t);
                     break;
                 }
             case Status.Queued:
                 {
                     ProcessStatusQueued(t);
                     break;
                 }
             case Status.Dispatched:
                 {
                     ProcessStatusDispatched(t);
                     break;
                 }
             case Status.Enroute:
                 {
                     ProcessStatusEnroute(t);
                     break;
                 }
             case Status.PickedUp:
                 {
                     ProcessStatusPickedUp(t);
                     break;
                 }
         }
     }
 }
开发者ID:TripThru,项目名称:Gateway,代码行数:35,代码来源:1396654558$PartnerGateway.cs


注:本文中的TripThruCore.PartnerTrip类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。