/// <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 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); } }
/// <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); } }