/// <summary>
        /// Create Territory with Rectangular Shape
        /// </summary>
        public void CreateRectTerritory()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Rect.Description(),
                    Data = new string[] {
                        "43.51668853502909,-109.3798828125",
                        "46.98025235521883,-101.865234375"
                    }
                }
            };

            // Run the query
            TerritoryZone territory = route4Me.CreateTerritory(territoryParameters,
                                                               out string errorString);

            if ((territory?.TerritoryId ?? null) != null)
            {
                TerritoryZonesToRemove.Add(territory.TerritoryId);
            }

            PrintExampleTerritory(territory, errorString);

            RemoveTestTerritoryZones();
        }
예제 #2
0
        /// <summary>
        /// Create Territory with Circular Shape
        /// </summary>
        public void CreateTerritory()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Circle.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "5000"
                    }
                }
            };

            // Run the query
            TerritoryZone territory = route4Me.CreateTerritory(territoryParameters,
                                                               out string errorString);

            if ((territory?.TerritoryId ?? null) != null)
            {
                TerritoryZonesToRemove.Add(territory.TerritoryId);
            }

            PrintExampleTerritory(territory, errorString);

            RemoveTestTerritoryZones();
        }
예제 #3
0
        /// <summary>
        /// Get Territory
        /// </summary>
        public void GetTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            string territoryId = "596A2A44FE9FB19EEB9C3C072BF2D0BE";

            TerritoryQuery territoryQuery1 = new TerritoryQuery
            {
                TerritoryId = territoryId,
                addresses   = 1
            };

            // Run the query
            string        errorString = "";
            TerritoryZone territory   = route4Me.GetTerritory(territoryQuery1, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("GetTerritory executed successfully");

                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("GetTerritory error: {0}", errorString);
            }
        }
        /// <summary>
        /// Create Territory with Rectangular Shape
        /// </summary>
        public void CreateRectTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Rect.Description(),
                    Data = new string[] {
                        "43.51668853502909,-109.3798828125",
                        "46.98025235521883,-101.865234375"
                    }
                }
            };

            // Run the query
            string        errorString = "";
            TerritoryZone territory   = route4Me.CreateTerritory(territoryParameters, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("CreateRectTerritory executed successfully");
                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("CreateRectTerritory error: {0}", errorString);
            }
        }
예제 #5
0
        /// <summary>
        /// Create Territory with Polygon Shape
        /// </summary>
        public void CreatePolygonTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Poly.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "37.75886716305343,-77.68974800109863",
                        "37.74763966054455,-77.6917221069336",
                        "37.74655084306813,-77.68863220214844",
                        "37.7502255383101,-77.68125076293945",
                        "37.74797991274437,-77.67498512268066",
                        "37.73327960206065,-77.6411678314209",
                        "37.74430510679532,-77.63172645568848",
                        "37.76641925847049,-77.66846199035645"
                    }
                }
            };

            // Run the query
            string        errorString = "";
            TerritoryZone territory   = route4Me.CreateTerritory(territoryParameters, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("CreatePolygonTerritory executed successfully");

                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("CreatePolygonTerritory error: {0}", errorString);
            }
        }
        /// <summary>
        /// Create Territory with Polygon Shape
        /// </summary>
        public void CreatePolygonTerritory()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Poly.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "37.75886716305343,-77.68974800109863",
                        "37.74763966054455,-77.6917221069336",
                        "37.74655084306813,-77.68863220214844",
                        "37.7502255383101,-77.68125076293945",
                        "37.74797991274437,-77.67498512268066",
                        "37.73327960206065,-77.6411678314209",
                        "37.74430510679532,-77.63172645568848",
                        "37.76641925847049,-77.66846199035645"
                    }
                }
            };

            // Run the query
            TerritoryZone territory = route4Me.CreateTerritory(territoryParameters,
                                                               out string errorString);

            if ((territory?.TerritoryId ?? null) != null)
            {
                TerritoryZonesToRemove.Add(territory.TerritoryId);
            }

            PrintExampleTerritory(territory, errorString);

            RemoveTestTerritoryZones();
        }
예제 #7
0
        /// <summary>
        /// Get Territory
        /// </summary>
        public void GetTerritory()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            CreateTerritoryZone();

            string territoryId = TerritoryZonesToRemove[TerritoryZonesToRemove.Count - 1];

            var territoryQuery = new TerritoryQuery
            {
                TerritoryId = territoryId,
                Addresses   = 1
            };

            // Run the query
            TerritoryZone territory = route4Me.GetTerritory(territoryQuery,
                                                            out string errorString);

            PrintExampleTerritory(territory, errorString);

            RemoveTestTerritoryZones();
        }
예제 #8
0
        /// <summary>
        /// Create Territory with Circular Shape
        /// </summary>
        public void CreateTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName  = "Test Territory",
                TerritoryColor = "ff0000",
                Territory      = new Territory
                {
                    Type = TerritoryType.Circle.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "5000"
                    }
                }
            };

            // Run the query
            string        errorString = "";
            TerritoryZone territory   = route4Me.CreateTerritory(territoryParameters, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("CreateTerritory executed successfully");

                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("CreateTerritory error: {0}", errorString);
            }
        }