本文整理汇总了C#中TripThruCore.Gateway类的典型用法代码示例。如果您正苦于以下问题:C# Gateway类的具体用法?C# Gateway怎么用?C# Gateway使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gateway类属于TripThruCore命名空间,在下文中一共展示了Gateway类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RegisterPartner
public override Gateway.RegisterPartnerResponse RegisterPartner(Gateway.RegisterPartnerRequest request)
{
Logger.BeginRequest("RegisterPartner sent to " + server.name, request);
Gateway.RegisterPartnerResponse response = server.RegisterPartner(request);
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396817753$TripThruGateway.cs
示例2: DispatchTrip
public override Gateway.DispatchTripResponse DispatchTrip(Gateway.DispatchTripRequest request)
{
Logger.BeginRequest("DispatchTrip sent to " + name, request);
GatewayService.Dispatch dispatch = new GatewayService.Dispatch
{
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,
PartnerId = request.partnerID,
FleetId = request.fleetID,
DriverId = request.driverID,
TripId = request.tripID
};
JsonServiceClient client = new JsonServiceClient(RootUrl);
GatewayService.DispatchResponse resp = client.Get<GatewayService.DispatchResponse>(dispatch);
Gateway.DispatchTripResponse response = new Gateway.DispatchTripResponse
{
result = resp.ResultCode,
};
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:33,代码来源:1396817121$GatewayClient.cs
示例3: Partner
public Partner(string ID, string name, Gateway tripthru, List<PartnerFleet> PartnerFleets = null, string preferedPartnerId = null)
: base(ID, name)
{
this.tripthru = tripthru;
this.preferedPartnerId = preferedPartnerId;
this.PartnerFleets = new Dictionary<string, PartnerFleet>();
if (PartnerFleets != null)
{
foreach (PartnerFleet f in PartnerFleets)
AddPartnerFleet(f);
}
tripsByID = new Dictionary<string, PartnerTrip>();
partnerAccounts.Clear();
clientIdByAccessToken.Clear();
{
PartnerAccount partnerAccount = new PartnerAccount
{
UserName = "TripThru",
Password = "password",
Email = "[email protected]",
AccessToken = "jaosid1201231",
RefreshToken = "jaosid1201231",
ClientId = "TripThru",
ClientSecret = "23noiasdn2123"
};
partnerAccounts[partnerAccount.ClientId] = partnerAccount;
clientIdByAccessToken[partnerAccount.AccessToken] = partnerAccount.ClientId;
}
}
开发者ID:TripThru,项目名称:Gateway,代码行数:31,代码来源:1396654558$PartnerGateway.cs
示例4: GetTripStatus
public override Gateway.GetTripStatusResponse GetTripStatus(Gateway.GetTripStatusRequest request)
{
Logger.BeginRequest("GetTripStatus sent to " + server.name, request);
Gateway.GetTripStatusResponse response = server.GetTripStatus(request);
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396817753$TripThruGateway.cs
示例5: QuoteTrip
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request)
{
Logger.BeginRequest("QuoteTrip sent to " + server.name, request);
Gateway.QuoteTripResponse response = server.QuoteTrip(request);
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396817753$TripThruGateway.cs
示例6: GetPartnerInfo
public override Gateway.GetPartnerInfoResponse GetPartnerInfo(Gateway.GetPartnerInfoRequest request)
{
Logger.BeginRequest("GetPartnerInfo sent to " + server.name, request);
Gateway.GetPartnerInfoResponse response = server.GetPartnerInfo(request);
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396817753$TripThruGateway.cs
示例7: Partner
public Partner(string ID, string name, Gateway tripthru, List<PartnerFleet> PartnerFleets = null, string preferedPartnerId = null)
: base(ID, name)
{
this.tripthru = tripthru;
this.preferedPartnerId = preferedPartnerId;
this.PartnerFleets = new Dictionary<string, PartnerFleet>();
if (PartnerFleets != null)
{
foreach (PartnerFleet f in PartnerFleets)
AddPartnerFleet(f);
}
tripsByID = new Dictionary<string, PartnerTrip>();
partnerAccounts.Clear();
clientIdByAccessToken.Clear();
var accounts = StorageManager.GetPartnerAccounts();
if (accounts != null)
foreach (PartnerAccount account in accounts)
{
if (Storage.Storage.UserRole.partner != account.Role && account.ClientId != "TripThru")
continue;
if (!partnerAccounts.ContainsKey(account.ClientId))
partnerAccounts[account.ClientId] = account;
if (!clientIdByAccessToken.ContainsKey(account.AccessToken))
clientIdByAccessToken[account.AccessToken] = account.ClientId;
}
PartnerTrip.nextID = base.activeTrips.lastID;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:31,代码来源:PartnerGateway.cs
示例8: DispatchTrip
public override Gateway.DispatchTripResponse DispatchTrip(Gateway.DispatchTripRequest request)
{
requests++;
requests++; //Assuming Tripthru will quote itself in AutoDispatch
Gateway.DispatchTripResponse resp = server.DispatchTrip(request);
if (resp.result == Gateway.Result.Rejected)
rejects++;
Gateway.DispatchTripResponse response = new Gateway.DispatchTripResponse
{
result = resp.result,
};
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396784377$GatewayClientMock.cs
示例9: GetPartnerInfo
public override Gateway.GetPartnerInfoResponse GetPartnerInfo(Gateway.GetPartnerInfoRequest request)
{
requests++;
Gateway.GetPartnerInfoResponse resp = server.GetPartnerInfo(request);
Gateway.GetPartnerInfoResponse response = new Gateway.GetPartnerInfoResponse
{
fleets = resp.fleets,
vehicleTypes = resp.vehicleTypes,
result = resp.result
};
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396784377$GatewayClientMock.cs
示例10: DispatchTrip
public override Gateway.DispatchTripResponse DispatchTrip(Gateway.DispatchTripRequest request)
{
requests++;
requests++; //Assuming Tripthru will quote itself in AutoDispatch
Gateway.DispatchTripResponse resp = server.DispatchTrip(request);
if (resp.result == Gateway.Result.Rejected)
rejects++;
if (resp.result == Result.OK)
{
var resp1 = GetTripStatus(new GetTripStatusRequest(request.clientID, request.tripID));
if (resp1.distance != null) distance = distance + resp1.distance.Value;
}
Gateway.DispatchTripResponse response = new Gateway.DispatchTripResponse
{
result = resp.result,
};
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:18,代码来源:1396784711$GatewayClientMock.cs
示例11: GetPartnerInfo
public override Gateway.GetPartnerInfoResponse GetPartnerInfo(Gateway.GetPartnerInfoRequest request)
{
Logger.BeginRequest("GetPartnerInfo sent to " + name, request);
JsonServiceClient client = new JsonServiceClient(RootUrl);
GatewayService.PartnersResponse resp = client.Get<GatewayService.PartnersResponse>(new GatewayService.Partners
{
access_token = AccessToken,
});
Gateway.GetPartnerInfoResponse response = new Gateway.GetPartnerInfoResponse
{
fleets = resp.Fleets,
vehicleTypes = resp.VehicleTypes,
result = resp.ResultCode
};
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:19,代码来源:1396817121$GatewayClient.cs
示例12: DispatchTrip
public override Gateway.DispatchTripResponse DispatchTrip(Gateway.DispatchTripRequest request)
{
Uri uri;
if (!Uri.TryCreate(RootUrl, UriKind.Absolute, out uri))
return new Gateway.DispatchTripResponse
{
result = Result.InvalidParameters
};
Logger.BeginRequest("DispatchTrip sent to " + name, request);
//Logger.Log("RootURL: " + RootUrl);
GatewayService.Trip dispatch = new GatewayService.Trip
{
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,
PartnerId = request.partnerID,
FleetId = request.fleetID,
DriverId = request.driverID,
TripId = request.tripID
};
JsonServiceClient client = new JsonServiceClient(RootUrl);
client.Timeout = timeout;
GatewayService.TripResponse resp = client.Post<GatewayService.TripResponse>(dispatch);
Gateway.DispatchTripResponse response = new Gateway.DispatchTripResponse
{
result = resp.ResultCode,
};
Logger.EndRequest(response);
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:41,代码来源:GatewayClient.cs
示例13: 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
示例14: GetTripStatus
public override Gateway.GetTripStatusResponse GetTripStatus(Gateway.GetTripStatusRequest request)
{
requests++;
Gateway.GetTripStatusResponse resp = server.GetTripStatus(request);
Gateway.GetTripStatusResponse response;
if (resp.result == Gateway.Result.OK)
{
response = new Gateway.GetTripStatusResponse
{
result = Gateway.Result.OK,
ETA = resp.ETA,
passengerName = resp.passengerName,
driverID = resp.driverID,
driverLocation = resp.driverLocation,
driverName = resp.driverName,
dropoffTime = resp.dropoffTime,
dropoffLocation = resp.dropoffLocation,
fleetName = resp.fleetName,
fleetID = resp.fleetID,
vehicleType = resp.vehicleType,
status = resp.status,
partnerName = resp.partnerName,
partnerID = resp.partnerID,
pickupTime = resp.pickupTime,
pickupLocation = resp.pickupLocation,
distance = resp.distance,
driverRouteDuration = resp.driverRouteDuration,
price = resp.price
};
}
else
{
response = new Gateway.GetTripStatusResponse
{
result = resp.result
};
}
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:39,代码来源:1396784377$GatewayClientMock.cs
示例15: RegisterPartner
public override Gateway.RegisterPartnerResponse RegisterPartner(Gateway.RegisterPartnerRequest request)
{
JsonServiceClient client = new JsonServiceClient(RootUrl);
GatewayService.PartnerResponse resp = client.Post<GatewayService.PartnerResponse>(new GatewayService.PartnerRequest
{
access_token = AccessToken,
Name = request.name,
CallbackUrl = request.callback_url
});
return new Gateway.RegisterPartnerResponse
{
result = resp.ResultCode
};
}
开发者ID:TripThru,项目名称:Gateway,代码行数:15,代码来源:1396817121$GatewayClient.cs
示例16: RecordTripOriginatingAndServicingPartner
private void RecordTripOriginatingAndServicingPartner(DispatchTripRequest r, Gateway partner)
{
originatingPartnerByTrip.Add(r.tripID, r.clientID);
Logger.AddTag("Originating partner", r.clientID);
servicingPartnerByTrip.Add(r.tripID, partner.ID);
Logger.AddTag("Servicing partner", partner.name);
}
开发者ID:TripThru,项目名称:Gateway,代码行数:7,代码来源:1396817753$TripThruGateway.cs
示例17: PickupLocationIsServedByPartner
private bool PickupLocationIsServedByPartner(QuoteTripRequest r, Gateway p)
{
bool covered = false;
foreach (Zone z in GetPartnerCoverage(p.ID))
{
if (z.IsInside(r.pickupLocation))
{
covered = true;
break;
}
}
return covered;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396817753$TripThruGateway.cs
示例18: UpdateTripStatus
public override Gateway.UpdateTripStatusResponse UpdateTripStatus(Gateway.UpdateTripStatusRequest request)
{
requests++;
UpdateTripStatusResponse resp = server.UpdateTripStatus(request);
if (resp.result == Gateway.Result.Rejected)
rejects++;
switch (request.status)
{
case Status.Cancelled:
cancels++;
break;
case Status.Complete:
completes++;
break;
}
Gateway.UpdateTripStatusResponse response;
response = new Gateway.UpdateTripStatusResponse
{
result = resp.result
};
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:22,代码来源:1396784377$GatewayClientMock.cs
示例19: GatewayClientMock
public GatewayClientMock(Gateway server)
: base(server.ID, server.name)
{
this.server = server;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:5,代码来源:1396784377$GatewayClientMock.cs
示例20: QuoteTrip
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request)
{
requests++;
Gateway.QuoteTripResponse resp = server.QuoteTrip(request);
if (resp.result == Gateway.Result.Rejected)
rejects++;
Gateway.QuoteTripResponse response = new Gateway.QuoteTripResponse
{
result = resp.result,
quotes = resp.quotes
};
return response;
}
开发者ID:TripThru,项目名称:Gateway,代码行数:13,代码来源:1396784377$GatewayClientMock.cs
注:本文中的TripThruCore.Gateway类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论