/// <summary> /// Get activities with the event Destination Inserted /// </summary> public void SearchDestinationInserted() { // Create the manager with the api key var route4Me = new Route4MeManager(ActualApiKey); RunOptimizationSingleDriverRoute10Stops(); string routeId = SD10Stops_route_id; OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; var newAddress = new Address() { AddressString = "118 Bill Johnson Rd NE Milledgeville GA 31061", Latitude = 33.141784667969, Longitude = -83.237518310547, Time = 0, SequenceNo = 4 }; int[] insertedDestinations = route4Me.AddRouteDestinations( routeId, new Address[] { newAddress }, out string errorString).Select(address => address.RouteDestinationId.GetValueOrDefault()).ToArray(); if (insertedDestinations == null || insertedDestinations.Length < 1) { Console.WriteLine( "Cannot insert the test destination." + Environment.NewLine + errorString); RemoveTestOptimizations(); return; } var activityParameters = new ActivityParameters { ActivityType = "insert-destination", RouteId = routeId }; // Run the query Activity[] activities = route4Me.GetActivities(activityParameters, out errorString); PrintExampleActivities(activities, errorString); RemoveTestOptimizations(); }
public int[] AddRouteDestinations(string routeId) { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); // Prepare the addresses Address[] addresses = new Address[] { #region Addresses new Address() { AddressString = "146 Bill Johnson Rd NE Milledgeville GA 31061", Latitude = 33.143526, Longitude = -83.240354, Time = 0 }, new Address() { AddressString = "222 Blake Cir Milledgeville GA 31061", Latitude = 33.177852, Longitude = -83.263535, Time = 0 } #endregion }; // Run the query bool optimalPosition = true; string errorString; int[] destinationIds = route4Me.AddRouteDestinations(routeId, addresses, optimalPosition, out errorString); Console.WriteLine(""); if (destinationIds != null) { Console.WriteLine("AddRouteDestinations executed successfully"); Console.WriteLine("Destination IDs: {0}", string.Join(" ", destinationIds)); } else { Console.WriteLine("AddRouteDestinations error: {0}", errorString); } return(destinationIds); }
public int[] AddRouteDestinations(string routeId) { // Create the manager with the api key Route4MeManager route4Me = new Route4MeManager(c_ApiKey); // Prepare the addresses Address[] addresses = new Address[] { #region Addresses new Address() { AddressString = "146 Bill Johnson Rd NE Milledgeville GA 31061", Latitude = 33.143526, Longitude = -83.240354, Time = 0 }, new Address() { AddressString = "222 Blake Cir Milledgeville GA 31061", Latitude = 33.177852, Longitude = -83.263535, Time = 0 } #endregion }; // Run the query bool optimalPosition = true; string errorString; int[] destinationIds = route4Me.AddRouteDestinations(routeId, addresses, optimalPosition, out errorString); Console.WriteLine(""); if (destinationIds != null) { Console.WriteLine("AddRouteDestinations executed successfully"); Console.WriteLine("Destination IDs: {0}", string.Join(" ", destinationIds)); } else { Console.WriteLine("AddRouteDestinations error: {0}", errorString); } return destinationIds; }
/// <summary> /// Add route destination in specific position /// </summary> public void AddRouteDestinationInSpecificPosition() { var route4Me = new Route4MeManager(this.ActualApiKey); RunOptimizationSingleDriverRoute10Stops(); OptimizationsToRemove = new List <string>() { SD10Stops_optimization_problem_id }; string route_id = SD10Stops_route_id; // Prepare the addresses #region Addresses Address[] addresses = new Address[] { new Address() { AddressString = "146 Bill Johnson Rd NE Milledgeville GA 31061", Latitude = 33.143526, Longitude = -83.240354, SequenceNo = 3, Time = 0 } }; #endregion // Run the query bool optimalPosition = false; int[] destinationIds = route4Me.AddRouteDestinations( route_id, addresses, optimalPosition, out string errorString); PrintExampleDestination(destinationIds, errorString); RemoveTestOptimizations(); }
/// <summary> /// Add destinations to a route. /// </summary> /// <param name="routeId">Route ID</param> /// <returns>An array of the added address IDs</returns> public int[] AddRouteDestinations(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; } // Prepare the addresses Address[] addresses = new Address[] { #region Addresses new Address() { AddressString = "146 Bill Johnson Rd NE Milledgeville GA 31061", Latitude = 33.143526, Longitude = -83.240354, Time = 0 }, new Address() { AddressString = "222 Blake Cir Milledgeville GA 31061", Latitude = 33.177852, Longitude = -83.263535, Time = 0 } #endregion }; // Run the query bool optimalPosition = true; ; int[] destinationIds = route4Me.AddRouteDestinations( routeId, addresses, optimalPosition, out string errorString); PrintExampleRouteResult(SD10Stops_route, errorString); if (isInnerExample) { RemoveTestOptimizations(); return(null); } else { return(destinationIds); } }