/// <summary>
        /// Remove Territory
        /// </summary>
        public void RemoveTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            string territoryId = "12ABBFA3B5E4FB007BB0ED73291576C2";

            AvoidanceZoneQuery territoryQuery = new AvoidanceZoneQuery {
                TerritoryId = territoryId
            };

            // Run the query
            string errorString = "";

            route4Me.RemoveTerritory(territoryQuery, out errorString);

            Console.WriteLine("");

            if (string.IsNullOrEmpty(errorString))
            {
                Console.WriteLine("RemoveTerritory executed successfully");

                Console.WriteLine("Territory ID: {0}", territoryId);
            }
            else
            {
                Console.WriteLine("RemoveTerritory error: {0}", errorString);
            }
        }
示例#2
0
        /// <summary>
        /// Get Avoidance Zone list
        /// </summary>
        public void GetAvoidanceZones()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneQuery avoidanceZoneQuery = new AvoidanceZoneQuery()
            {
            };

            // Run the query
            string errorString;

            AvoidanceZone[] avoidanceZones = route4Me.GetAvoidanceZones(avoidanceZoneQuery, out errorString);

            Console.WriteLine("");

            if (avoidanceZones != null)
            {
                Console.WriteLine("GetAvoidanceZones executed successfully, {0} zones returned", avoidanceZones.Length);
            }
            else
            {
                Console.WriteLine("GetAvoidanceZones error: {0}", errorString);
            }
        }
示例#3
0
        /// <summary>
        /// Get Avoidance Zone
        /// </summary>
        /// <param name="territoryId"> Avoidance Zone Id </param>
        public void GetAvoidanceZone(string territoryId)
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneQuery avoidanceZoneQuery = new AvoidanceZoneQuery()
            {
                TerritoryId = territoryId
            };

            // Run the query
            string        errorString;
            AvoidanceZone avoidanceZone = route4Me.GetAvoidanceZone(avoidanceZoneQuery, out errorString);

            Console.WriteLine("");

            if (avoidanceZone != null)
            {
                Console.WriteLine("GetAvoidanceZone executed successfully");

                Console.WriteLine("Territory ID: {0}", avoidanceZone.TerritoryId);
            }
            else
            {
                Console.WriteLine("GetAvoidanceZone error: {0}", errorString);
            }
        }
        /// <summary>
        /// Get Avoidance Zone
        /// </summary>
        /// <param name="territoryId"> Avoidance Zone Id </param>
        public void GetAvoidanceZone(string territoryId = null)
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            bool isInnerExample = territoryId == null ? true : false;

            if (isInnerExample)
            {
                CreateAvoidanceZone();
                territoryId = this.avoidanceZone.TerritoryId;
            }

            var avoidanceZoneQuery = new AvoidanceZoneQuery()
            {
                TerritoryId = territoryId
            };

            // Run the query
            AvoidanceZone avoidanceZone = route4Me.GetAvoidanceZone(
                avoidanceZoneQuery,
                out string errorString);

            PrintExampleAvoidanceZone(avoidanceZone, errorString);

            if (isInnerExample)
            {
                RemoveAvidanceZone(territoryId);
            }
        }
        /// <summary>
        /// Get Territories
        /// </summary>
        public void GetTerritories()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var territoryQuery = new AvoidanceZoneQuery();

            // Run the query
            AvoidanceZone[] territories = route4Me.GetTerritories(territoryQuery,
                                                                  out string errorString);

            PrintExampleTerritory(territories, errorString);
        }
示例#6
0
        /// <summary>
        /// Get Avoidance Zone list
        /// </summary>
        public void GetAvoidanceZones()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            var avoidanceZoneQuery = new AvoidanceZoneQuery()
            {
            };

            // Run the query
            AvoidanceZone[] avoidanceZones = route4Me.GetAvoidanceZones(
                avoidanceZoneQuery,
                out string errorString);

            Console.WriteLine("");

            Console.WriteLine(
                avoidanceZones != null
                ? String.Format("GetAvoidanceZones executed successfully, {0} zones returned", avoidanceZones.Length)
                : String.Format("GetAvoidanceZones error: {0}", errorString)
                );
        }
示例#7
0
        /// <summary>
        /// Remove Territory
        /// </summary>
        public void RemoveTerritory()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManager(ActualApiKey);

            CreateTerritoryZone();

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

            var territoryQuery = new AvoidanceZoneQuery
            {
                TerritoryId = territoryId
            };

            // Run the query
            bool removed = route4Me.RemoveTerritory(territoryQuery, out string errorString);

            Console.WriteLine(
                removed
                ? String.Format("The territory {0} removed successfully", territoryId)
                : String.Format("Cannot remove the territory {0}", territoryId) + Environment.NewLine + errorString
                );
        }