/// <summary> /// /// </summary> /// <param name="Latitude"></param> /// <param name="Longitude"></param> /// <param name="maxDistance"></param> /// <param name="maxResults"></param> /// <returns> /// /api/GetLocations?Latitude=52.950175&Longitude=4.766285&maxDistance=10000&maxResults=100 /// </returns> public List <Location> Get(double Latitude, double Longitude, int maxDistance, int maxResults) { List <Location> lLocations = new List <Location>(); using (GeoQuerys gq = new GeoQuerys()) { Location location = new Location("P1", Latitude, Longitude); lLocations = gq.GetLocations(location, maxDistance, maxResults); } return(lLocations); }
public void GetLocationsTest() { GeoQuerys target = new GeoQuerys(); // TODO: Initialize to an appropriate value Location pLocation = new Location("P1", double.Parse("52.2165425"), double.Parse("5.4778534")); // TODO: Initialize to an appropriate value int maxDistance = 10000; // TODO: Initialize to an appropriate value int maxResults = 100; // TODO: Initialize to an appropriate value SearchResults sr = new SearchResults(); SearchResults actual; sr.StartSearch("52.2165425", "5.4778534", maxDistance.ToString(), maxResults.ToString()); actual = target.GetLocations(pLocation, maxDistance, maxResults, sr); actual.EndSearch(""); Assert.AreEqual(maxResults.ToString(), actual.maxResults); }
public SearchResults GetLocations(string Latitude, string Longitude, string maxDistance, string maxResults) { ///I've implmented a class to register the Exceptions and traces of the application. ///This Trace class is connected with a 3rd Party System called franrodriguez.loggly.com using (Trace t = new Trace("SearchService", "GetLocations")) { using (SearchResults sr = new SearchResults()) { SearchResults srDetailed = new SearchResults(); try { //Start the Search sr.StartSearch(Latitude, Longitude, maxDistance, maxResults); //Lock the object to manage the interlocking of the request lock (this.ThisLock) { //Call to the internal Controller to make the search using (IGeoQuerys gq = new GeoQuerys()) { Location location = new Location("P1", double.Parse(Latitude), double.Parse(Longitude)); srDetailed = gq.GetLocations(location, Int32.Parse(maxDistance), Int32.Parse(maxResults), sr); //End the Search srDetailed.EndSearch(""); } } } catch (Exception e) { t.Error(e.Message.ToString(), e); srDetailed.EndSearch(e.Message.ToString()); } //Give back the json object return(srDetailed); } } }