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


C# Api.ExecuteRequest方法代码示例

本文整理汇总了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);
        }
开发者ID:trackmatic,项目名称:gettingstarted-dotnet,代码行数:101,代码来源:Program.cs


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