/// <summary> /// Resequence the route destinations. /// </summary> /// <param name="route">A route object</param> public void ResequenceRouteDestinations(DataObjectRoute route = null) { bool isInnerExample = route == null ? true : false; if (isInnerExample) { RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; route = SD10Stops_route; } // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); // Switch 2 addresses after departure address: AddressesOrderInfo addressesOrderInfo = new AddressesOrderInfo(); addressesOrderInfo.RouteId = route.RouteID; addressesOrderInfo.Addresses = new AddressInfo[0]; for (int i = 0; i < route.Addresses.Length; i++) { Address address = route.Addresses[i]; AddressInfo addressInfo = new AddressInfo(); addressInfo.DestinationId = address.RouteDestinationId.Value; addressInfo.SequenceNo = i; addressInfo.SequenceNo = i == 1 ? 2 : 1; addressInfo.IsDepot = (addressInfo.SequenceNo == 0); var addressesList = new List <AddressInfo>(addressesOrderInfo.Addresses); addressesList.Add(addressInfo); addressesOrderInfo.Addresses = addressesList.ToArray(); } // Run the query DataObjectRoute route1 = route4Me .GetJsonObjectFromAPI <DataObjectRoute>(addressesOrderInfo, R4MEInfrastructureSettings.RouteHost, HttpMethodType.Put, out string errorString1); // Output the result PrintExampleRouteResult(route1, errorString1); if (isInnerExample) { RemoveTestOptimizations(); } }
public void ReoptimizeRoute(string routeId) { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); RouteParametersQuery routeParameters = new RouteParametersQuery() { RouteId = routeId, ReOptimize = true }; // Run the query string errorString; DataObjectRoute dataObject = route4Me.UpdateRoute(routeParameters, out errorString); Console.WriteLine(""); if (dataObject != null) { Console.WriteLine("ReoptimizeRoute executed successfully"); Console.WriteLine("Route ID: {0}", dataObject.RouteID); Console.WriteLine("State: {0}", dataObject.State); } else { Console.WriteLine("ReoptimizeRoute error: {0}", errorString); } }
public void GetRoute(string routeId) { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); RouteParametersQuery routeParameters = new RouteParametersQuery() { RouteId = routeId }; // Run the query string errorString; DataObjectRoute dataObject = route4Me.GetRoute(routeParameters, out errorString); Console.WriteLine(""); if (dataObject != null) { Console.WriteLine("GetRoute executed successfully"); Console.WriteLine("Route ID: {0}", dataObject.RouteID); Console.WriteLine("State: {0}", dataObject.State); /*foreach (Address a in dataObject.Addresses) * { * Console.WriteLine("addr: {0}, {1}, {2}, {3}, {4}", a.RouteDestinationId, a.Latitude, a.Longitude, a.Alias, a.AddressString); * }*/ } else { Console.WriteLine("GetRoute error: {0}", errorString); } }
public void GetRoute(string routeId, bool getRouteDirections, bool getRoutePathPoints) { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); RouteParametersQuery routeParameters = new RouteParametersQuery() { RouteId = routeId }; if (getRouteDirections) { routeParameters.Directions = true; } if (getRoutePathPoints) { routeParameters.RoutePathOutput = RoutePathOutput.Points.ToString(); } // Run the query string errorString; DataObjectRoute dataObject = route4Me.GetRoute(routeParameters, out errorString); Console.WriteLine(""); if (dataObject != null) { Console.WriteLine("GetRoute executed successfully"); Console.WriteLine("Route ID: {0}", dataObject.RouteID); Console.WriteLine("State: {0}", dataObject.State); /*foreach (Address a in dataObject.Addresses) * { * Console.WriteLine("addr: {0}, {1}, {2}, {3}, {4}", a.RouteDestinationId, a.Latitude, a.Longitude, a.Alias, a.AddressString); * }*/ if (dataObject.Directions != null) { Console.WriteLine("Directions: lenth = {0}", dataObject.Directions.Length); } if (dataObject.Path != null) { Console.WriteLine("Path: lenth = {0}", dataObject.Path.Length); } } else { Console.WriteLine("GetRoute error: {0}", errorString); } }
public void ResequenceRouteDestinations(DataObjectRoute route) { if (route.Addresses == null && route.Addresses.Length < 3) { Console.WriteLine("ResequenceRouteDestinations error {0}", "route.Addresses == null && route.Addresses.Length < 3. Number of addresses should be >= 3"); return; } // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); // Switch 2 addresses after departure address: AddressesOrderInfo addressesOrderInfo = new AddressesOrderInfo(); addressesOrderInfo.RouteId = route.RouteID; addressesOrderInfo.Addresses = new AddressInfo[0]; for (int i = 0; i < route.Addresses.Length; i++) { Address address = route.Addresses[i]; AddressInfo addressInfo = new AddressInfo(); addressInfo.DestinationId = address.RouteDestinationId.Value; addressInfo.SequenceNo = i; if (i == 1) { addressInfo.SequenceNo = 2; } else if (i == 2) { addressInfo.SequenceNo = 1; } addressInfo.IsDepot = (addressInfo.SequenceNo == 0); List <AddressInfo> addressesList = new List <AddressInfo>(addressesOrderInfo.Addresses); addressesList.Add(addressInfo); addressesOrderInfo.Addresses = addressesList.ToArray(); } // Run the query string errorString1 = ""; DataObjectRoute route1 = route4Me.GetJsonObjectFromAPI <DataObjectRoute>(addressesOrderInfo, R4MEInfrastructureSettings.RouteHost, HttpMethodType.Put, out errorString1); // Output the result PrintExampleOptimizationResult("ResequenceRouteDestinations, switch 2 addresses.", route1, errorString1); Console.WriteLine(""); }
/// <summary> /// Get a route by route ID /// </summary> /// <param name="routeId">Route ID</param> /// <param name="getRouteDirections">If true, the directions included in the response</param> /// <param name="getRoutePathPoints">If true, the path points included in the response</param> public void GetRoute(string routeId = null, bool?getRouteDirections = null, bool?getRoutePathPoints = null) { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); bool isInnerExample = routeId == null ? true : false; if (isInnerExample) { RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; routeId = SD10Stops_route_id; getRouteDirections = true; getRoutePathPoints = true; } var routeParameters = new RouteParametersQuery() { RouteId = routeId, Directions = getRouteDirections, RoutePathOutput = getRoutePathPoints == true ? RoutePathOutput.Points.ToString() : "" }; // Run the query DataObjectRoute dataObject = route4Me.GetRoute( routeParameters, out string errorString ); PrintExampleRouteResult(dataObject, errorString); if (isInnerExample) { RemoveTestOptimizations(); } }
public void UpdateRoute(string routeId = null) { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); bool isInnerExample = routeId == null ? true : false; if (isInnerExample) { RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; routeId = SD10Stops_route_id; } var parametersNew = new RouteParameters() { RouteName = "New name of the route" }; var routeParameters = new RouteParametersQuery() { RouteId = routeId, Parameters = parametersNew }; // Run the query DataObjectRoute dataObject = route4Me.UpdateRoute( routeParameters, out string errorString ); PrintExampleRouteResult(dataObject, errorString); RemoveTestOptimizations(); }
public void ReoptimizeRoute(string routeId = null) { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); bool isInnerExample = routeId == null ? true : false; if (isInnerExample) { RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new System.Collections.Generic.List <string>() { SD10Stops_optimization_problem_id }; routeId = SD10Stops_route_id; } var routeParameters = new RouteParametersQuery() { RouteId = routeId, ReOptimize = true }; // Run the query DataObjectRoute dataObject = route4Me.UpdateRoute( routeParameters, out string errorString ); PrintExampleRouteResult(dataObject, errorString); if (isInnerExample) { RemoveTestOptimizations(); } }
/// <summary> /// The example refers to the process of updating many parameters /// simultaneously of the route destination by sending the HTTP parameters. /// </summary> public void UpdateRouteDestination() { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; int routeDestionationId = (int)SD10Stops_route.Addresses[1].RouteDestinationId; var CustomData = new Dictionary <string, string>(); CustomData.Add("BatchId", "e7c672b1-a356-4a97-803e-97db88fdcf99"); CustomData.Add("CustomerNumber", "2718500"); CustomData.Add("DeliveryId", "2c71f6d9-c1aa-4672-a682-3e9f12badac9"); CustomData.Add( "DeliveryInvoices", "<?xml version=\"1.0\" encoding=\"utf-16\"?>\u000d\u000a<!DOCTYPE EXAMPLEDelivery SYSTEM \"EXAMPLEDelivery.dtd\">\u000d\u000a<ArrayOfRouteDeliveryInvoice>\u000d\u000a <RouteDeliveryInvoice>\u000d\u000a <InvoiceNumber>999999</InvoiceNumber>\u000d\u000a <InventoryIds>\u000d\u000a <string>1790908</string>\u000d\u000a </InventoryIds>\u000d\u000a <IsRA>false</IsRA>\u000d\u000a <IsDT>false</IsDT>\u000d\u000a <IsINC>true</IsINC>\u000d\u000a <IsPO>false</IsPO>\u000d\u000a <IsPOPickup>false</IsPOPickup>\u000d\u000a </RouteDeliveryInvoice>\u000d\u000a</ArrayOfRouteDeliveryInvoice>" ); CustomData.Add("DeliveryNotes", ""); CustomData.Add("RouteId", "20191"); // Run the query var routeParameters = new RouteParametersQuery() { RouteId = SD10Stops_route_id }; string errorString; DataObjectRoute dataObject = route4Me.GetRoute(routeParameters, out errorString); Address oAddress = dataObject.Addresses .Where(x => x.RouteDestinationId == routeDestionationId) .FirstOrDefault(); var routeParams = new RouteParametersQuery() { RouteId = SD10Stops_route_id, RouteDestinationId = oAddress.ContactId }; oAddress.Alias = "Steele's - MONTICELLO"; oAddress.Cost = 5; oAddress.InvoiceNo = "945825"; // etc fill the necessary address parameters oAddress.CustomFields = new Dictionary <string, string> { { "Test Custom Fields", "Test custom Data" } }; errorString = ""; Address address = route4Me.UpdateRouteDestination(oAddress, out errorString); Console.WriteLine(""); if (address != null) { Console.WriteLine("UpdateRouteDestination executed successfully"); Console.WriteLine("Alias {0}", address.Alias); Console.WriteLine("Cost {0}", address.Cost); Console.WriteLine("InvoiceNo {0}", address.InvoiceNo); foreach (KeyValuePair <string, string> kvpair in address.CustomFields) { Console.WriteLine(kvpair.Key + ": " + kvpair.Value); } } else { Console.WriteLine("UpdateRouteDestination error {0}", errorString); } RemoveTestOptimizations(); }
public void UpdateRouteDestination() { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager("11111111111111111111111111111111"); // The example refers to the process of updating many parameters simultaneously of the route destination by sending the HTTP parameters. string routeId = "824CA521E3A8DE9F1C684C8BAE90CF07"; int routeDestionationId = 217393034; Dictionary <string, string> CustomData = new Dictionary <string, string>(); CustomData.Add("BatchId", "e7c672b1-a356-4a97-803e-97db88fdcf99"); CustomData.Add("CustomerNumber", "2718500"); CustomData.Add("DeliveryId", "2c71f6d9-c1aa-4672-a682-3e9f12badac9"); CustomData.Add("DeliveryInvoices", "<?xml version=\"1.0\" encoding=\"utf-16\"?>\u000d\u000a<!DOCTYPE EXAMPLEDelivery SYSTEM \"EXAMPLEDelivery.dtd\">\u000d\u000a<ArrayOfRouteDeliveryInvoice>\u000d\u000a <RouteDeliveryInvoice>\u000d\u000a <InvoiceNumber>999999</InvoiceNumber>\u000d\u000a <InventoryIds>\u000d\u000a <string>1790908</string>\u000d\u000a </InventoryIds>\u000d\u000a <IsRA>false</IsRA>\u000d\u000a <IsDT>false</IsDT>\u000d\u000a <IsINC>true</IsINC>\u000d\u000a <IsPO>false</IsPO>\u000d\u000a <IsPOPickup>false</IsPOPickup>\u000d\u000a </RouteDeliveryInvoice>\u000d\u000a</ArrayOfRouteDeliveryInvoice>"); CustomData.Add("DeliveryNotes", ""); CustomData.Add("RouteId", "20191"); // Run the query RouteParametersQuery routeParameters = new RouteParametersQuery() { RouteId = routeId }; string errorString; DataObjectRoute dataObject = route4Me.GetRoute(routeParameters, out errorString); foreach (Address oAddress in dataObject.Addresses) { if (oAddress.RouteDestinationId == routeDestionationId) { RouteParametersQuery routeParams = new RouteParametersQuery() { RouteId = routeId, RouteDestinationId = oAddress.ContactId }; oAddress.Alias = "Steele's - MONTICELLO"; oAddress.Cost = 5; oAddress.InvoiceNo = 945825; // etc fill the necessary address parameters oAddress.CustomFields = new Dictionary <string, string> { { "Test Custom Fields", "Test custom Data" } }; errorString = ""; Address address = route4Me.UpdateRouteDestination(oAddress, out errorString); Console.WriteLine(""); if (address != null) { Console.WriteLine("UpdateRouteDestination executed successfully"); Console.WriteLine("Alias {0}", address.Alias); Console.WriteLine("Cost {0}", address.Cost); Console.WriteLine("InvoiceNo {0}", address.InvoiceNo); foreach (KeyValuePair <string, string> kvpair in address.CustomFields) { Console.WriteLine(kvpair.Key + ": " + kvpair.Value); } } else { Console.WriteLine("UpdateRouteDestination error {0}", errorString); } } } }
static void Main(string[] args) { Route4MeExamples examples = new Route4MeExamples(); DataObject dataObject = null; DataObject dataObject1 = examples.SingleDriverRoute10Stops(); dataObject = dataObject1; DataObjectRoute routeSingleDriverRoute10Stops = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0] : null; string routeId_SingleDriverRoute10Stops = (routeSingleDriverRoute10Stops != null) ? routeSingleDriverRoute10Stops.RouteID : null; if (routeSingleDriverRoute10Stops != null) { examples.ResequenceRouteDestinations(routeSingleDriverRoute10Stops); } else { System.Console.WriteLine("ResequenceRouteDestinations not called. routeSingleDriverRoute10Stops == null."); } if (routeSingleDriverRoute10Stops != null) { examples.ResequenceReoptimizeRoute(routeId_SingleDriverRoute10Stops); } else { System.Console.WriteLine("ResequenceReoptimizeRoute not called. routeSingleDriverRoute10Stops == null."); } int[] destinationIds = examples.AddRouteDestinations(routeId_SingleDriverRoute10Stops); if (destinationIds != null && destinationIds.Length > 0) { examples.RemoveRouteDestination(routeId_SingleDriverRoute10Stops, destinationIds[0]); } DataObject dataObject2 = examples.SingleDriverRoundTrip(); dataObject = dataObject2; string routeId_SingleDriverRoundTrip = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; string routeIdToMoveTo = routeId_SingleDriverRoundTrip; int routeDestinationIdToMove = (dataObject1 != null && dataObject1.Routes != null && dataObject1.Routes.Length > 0 && dataObject1.Routes[0].Addresses.Length > 1 && dataObject1.Routes[0].Addresses[1].RouteDestinationId != null) ? dataObject1.Routes[0].Addresses[1].RouteDestinationId.Value : 0; int afterDestinationIdToMoveAfter = (dataObject2 != null && dataObject2.Routes != null && dataObject2.Routes.Length > 0 && dataObject2.Routes[0].Addresses.Length > 1 && dataObject2.Routes[0].Addresses[0].RouteDestinationId != null) ? dataObject2.Routes[0].Addresses[0].RouteDestinationId.Value : 0; if (routeIdToMoveTo != null && routeDestinationIdToMove != 0 && afterDestinationIdToMoveAfter != 0) { examples.MoveDestinationToRoute(routeIdToMoveTo, routeDestinationIdToMove, afterDestinationIdToMoveAfter); } else { System.Console.WriteLine("MoveDestinationToRoute not called. routeDestinationId = {0}, afterDestinationId = {1}.", routeDestinationIdToMove, afterDestinationIdToMoveAfter); } string optimizationProblemID = examples.SingleDriverRoundTripGeneric(); dataObject = examples.MultipleDepotMultipleDriver(); string routeId_MultipleDepotMultipleDriver = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; dataObject = examples.MultipleDepotMultipleDriverTimeWindow(); string routeId_MultipleDepotMultipleDriverTimeWindow = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; dataObject = examples.SingleDepotMultipleDriverNoTimeWindow(); string routeId_SingleDepotMultipleDriverNoTimeWindow = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; dataObject = examples.MultipleDepotMultipleDriverWith24StopsTimeWindow(); string routeId_MultipleDepotMultipleDriverWith24StopsTimeWindow = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; dataObject = examples.SingleDriverMultipleTimeWindows(); string routeId_SingleDriverMultipleTimeWindows = (dataObject != null && dataObject.Routes != null && dataObject.Routes.Length > 0) ? dataObject.Routes[0].RouteID : null; if (optimizationProblemID != null) { examples.GetOptimization(optimizationProblemID); } else { System.Console.WriteLine("GetOptimization not called. optimizationProblemID == null."); } examples.GetOptimizations(); if (optimizationProblemID != null) { dataObject = examples.AddDestinationToOptimization(optimizationProblemID, true); } else { System.Console.WriteLine("AddDestinationToOptimization not called. optimizationProblemID == null."); dataObject = null; } if (optimizationProblemID != null) { Address destinationToRemove = (dataObject != null && dataObject.Addresses.Length > 0) ? dataObject.Addresses[dataObject.Addresses.Length - 1] : null; if (destinationToRemove != null) { examples.RemoveDestinationFromOptimization(optimizationProblemID, destinationToRemove.RouteDestinationId.Value, false); } else { System.Console.WriteLine("RemoveDestinationFromOptimization not called. destinationToRemove == null."); } } else { System.Console.WriteLine("RemoveDestinationFromOptimization not called. optimizationProblemID == null."); } if (optimizationProblemID != null) { examples.ReOptimization(optimizationProblemID); } else { System.Console.WriteLine("ReOptimization not called. optimizationProblemID == null."); } if (routeId_SingleDriverRoute10Stops != null) { examples.UpdateRoute(routeId_SingleDriverRoute10Stops); examples.ReoptimizeRoute(routeId_SingleDriverRoute10Stops); bool getRouteDirections = true; bool getRoutePathPoints = true; examples.GetRoute(routeId_SingleDriverRoute10Stops, getRouteDirections, getRoutePathPoints); } else { System.Console.WriteLine("UpdateRoute, ReoptimizeRoute, GetRoute not called. routeId_SingleDriverRoute10Stops == null."); } examples.GetRoutes(); examples.GetUsers(); if (routeId_SingleDriverRoute10Stops != null) { examples.LogCustomActivity("Test User Activity " + DateTime.Now.ToString(), routeId_SingleDriverRoute10Stops); } else { System.Console.WriteLine("LogCustomActivity not called. routeId_SingleDriverRoute10Stops == null."); } if (routeId_SingleDriverRoute10Stops != null) { examples.GetActivities(routeId_SingleDriverRoute10Stops); } else { System.Console.WriteLine("GetActivities not called. routeId_SingleDriverRoute10Stops == null."); } if (routeIdToMoveTo != null && routeDestinationIdToMove != 0) { examples.GetAddress(routeIdToMoveTo, routeDestinationIdToMove); examples.AddAddressNote(routeIdToMoveTo, routeDestinationIdToMove); examples.AddAddressNoteWithFile(routeIdToMoveTo, routeDestinationIdToMove); examples.GetAddressNotes(routeIdToMoveTo, routeDestinationIdToMove); } else { System.Console.WriteLine("AddAddressNote, GetAddress, GetAddressNotes not called. routeIdToMoveTo == null || routeDestinationIdToMove == 0."); } string routeId_DuplicateRoute = null; if (routeId_SingleDriverRoute10Stops != null) { routeId_DuplicateRoute = examples.DuplicateRoute(routeId_SingleDriverRoute10Stops); } else { System.Console.WriteLine("DuplicateRoute not called. routeId_SingleDriverRoute10Stops == null."); } //disabled by default, not necessary for optimization tests //not all accounts are capable of storing gps data /*if (routeId_SingleDriverRoute10Stops != null) * { * examples.SetGPSPosition(routeId_SingleDriverRoute10Stops); * examples.TrackDeviceLastLocationHistory(routeId_SingleDriverRoute10Stops); * } * else * { * System.Console.WriteLine("SetGPSPosition, TrackDeviceLastLocationHistory not called. routeId_SingleDriverRoute10Stops == null."); * }*/ List <string> routeIdsToDelete = new List <string>(); if (routeId_SingleDriverRoute10Stops != null) { routeIdsToDelete.Add(routeId_SingleDriverRoute10Stops); } if (routeId_SingleDriverRoundTrip != null) { routeIdsToDelete.Add(routeId_SingleDriverRoundTrip); } if (routeId_DuplicateRoute != null) { routeIdsToDelete.Add(routeId_DuplicateRoute); } if (routeId_MultipleDepotMultipleDriver != null) { routeIdsToDelete.Add(routeId_MultipleDepotMultipleDriver); } if (routeId_MultipleDepotMultipleDriverTimeWindow != null) { routeIdsToDelete.Add(routeId_MultipleDepotMultipleDriverTimeWindow); } if (routeId_SingleDepotMultipleDriverNoTimeWindow != null) { routeIdsToDelete.Add(routeId_SingleDepotMultipleDriverNoTimeWindow); } if (routeId_MultipleDepotMultipleDriverWith24StopsTimeWindow != null) { routeIdsToDelete.Add(routeId_MultipleDepotMultipleDriverWith24StopsTimeWindow); } if (routeId_SingleDriverMultipleTimeWindows != null) { routeIdsToDelete.Add(routeId_SingleDriverMultipleTimeWindows); } if (routeIdsToDelete.Count > 0) { examples.DeleteRoutes(routeIdsToDelete.ToArray()); } else { System.Console.WriteLine("routeIdsToDelete.Count == 0. DeleteRoutes not called."); } // Remove optimization if (optimizationProblemID != null) { List <string> lsOptIDs = new List <string>(); lsOptIDs.Add(optimizationProblemID); examples.RemoveOptimization(lsOptIDs.ToArray()); } else { System.Console.WriteLine("RemoveOptimization not called. optimizationProblemID == null."); } // Address Book AddressBookContact contact1 = examples.AddAddressBookContact(); AddressBookContact contact2 = examples.AddAddressBookContact(); examples.GetAddressBookContacts(); if (contact1 != null) { contact1.last_name = "Updated " + (new Random()).Next().ToString(); examples.UpdateAddressBookContact(contact1); } else { System.Console.WriteLine("contact1 == null. UpdateAddressBookContact not called."); } List <string> addressIdsToRemove = new List <string>(); if (contact1 != null) { addressIdsToRemove.Add(contact1.address_id.ToString()); } if (contact2 != null) { addressIdsToRemove.Add(contact2.address_id.ToString()); } examples.RemoveAddressBookContacts(addressIdsToRemove.ToArray()); // Avoidance Zones string territoryId = examples.AddAvoidanceZone(); examples.GetAvoidanceZones(); if (territoryId != null) { examples.GetAvoidanceZone(territoryId); } else { System.Console.WriteLine("GetAvoidanceZone not called. territoryId == null."); } if (territoryId != null) { examples.UpdateAvoidanceZone(territoryId); } else { System.Console.WriteLine("UpdateAvoidanceZone not called. territoryId == null."); } if (territoryId != null) { examples.DeleteAvoidanceZone(territoryId); } else { System.Console.WriteLine("DeleteAvoidanceZone not called. territoryId == null."); } // Orders Order order1 = examples.AddOrder(); Order order2 = examples.AddOrder(); examples.GetOrders(); if (order1 != null) { order1.EXT_FIELD_last_name = "Updated " + (new Random()).Next().ToString(); examples.UpdateOrder(order1); } else { System.Console.WriteLine("order1 == null. UpdateOrder not called."); } List <string> orderIdsToRemove = new List <string>(); if (order1 != null) { orderIdsToRemove.Add(order1.order_id.ToString()); } if (order2 != null) { orderIdsToRemove.Add(order2.order_id.ToString()); } examples.RemoveOrders(orderIdsToRemove.ToArray()); examples.GenericExample(); examples.GenericExampleShortcut(); System.Console.WriteLine(""); System.Console.WriteLine("Press any key"); System.Console.ReadKey(); }