本文整理汇总了C#中Api.ExecuteRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Api.ExecuteRequest方法的具体用法?C# Api.ExecuteRequest怎么用?C# Api.ExecuteRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api.ExecuteRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
Authority = EAuthority.Trackmatic
},
new EntityRequirementsDescriptor
{
Authority = EAuthority.Lob
},
new RelationshipMstDescriptor
{
Authority = EAuthority.Lob
}
};
var reference = "DEMO110";
// Upload various components and create route
// Note: in order to just upload DECO's entities and actions just ignore the Route field
var request = new UploadModel
{
Actions = actions.ToList(),
Decos = decos.ToList(),
Entities = entities.ToList(),
Relationships = relationships.ToList(),
Route = new RouteModel
{
StartDate = DateTime.UtcNow,
Id = $"{_clientId}/{reference}",
TemplateId = templateId,
Reference = reference,
Registration = "BR31CMGP",
Name = "My New Route Name",
Options = new RouteOptions
{
AutomatedAdjustment = new AutomatedAdjustmentOptions
{
Enabled = true,
Threshold = TimeSpan.FromMinutes(15)
},
Lock = new LockOptions
{
All = true,
Start = true,
End = true
},
MaxSpeed = 100,
Strategy = ERouteStrategy.Shortest,
Temperature = 100
},
DueTimeAdjustments = new List<DueTimeAdjustmentModel>
{
new DueTimeAdjustmentModel
{
Adjustment = TimeSpan.FromMinutes(30),
Position = new End(),
Type = EDueTimeAdjustmentType.Layover
}
},
Schedule = false
},
Descriptors = descriptors
};
var json = request.ToJson(true);
var start = DateTime.UtcNow;
Console.WriteLine(start);
var response = _api.ExecuteRequest(new Upload(_api.Context, request)).Data;
Console.WriteLine(DateTime.UtcNow.Subtract(start));
Console.ReadLine();
//// Optmise can be called on the route many times
//// This is only really required if you add/remove DECOS and you require the order to the DECO's to be optmised again
//response = Optimise(response.Instance);
//// Set lock all to true to prevent re-ordering of the decos
//// and allow users to change the order manually
//response.Instance.Route.LockAll = true;
//var secondStop = response.Instance.Route.RouteDecos[2];
//// Move 2nd stop to the last stop
//response.Instance.Route.MoveDown(secondStop);
//secondStop = response.Instance.Route.RouteDecos[2];
//// Move 2nd stop to 1st position
//response.Instance.Route.MoveUp(secondStop);
//// The save method will perform an optmisation on the route automatically
//Save(response.Instance);
}