Esempio n. 1
0
        internal IEnumerable <Location> GetNearestLocations(double SearchLat, double SearchLong, int QuantityReturned, Guid FilterByLocationTypeKey)
        {
            CurrentCollection.Clear();
            var sql = new Sql();

            sql.Select(string.Format("TOP({0}) *", QuantityReturned))
            .From <LocationDto>()
            .Append(GeographyHelper.GetGeoNearestSql(SearchLat, SearchLong, FilterByLocationTypeKey));

            var dtoResult = Repositories.ThisDb.Query <LocationDto>(sql).ToList();

            var converter = new DtoConverter();

            CurrentCollection.AddRange(converter.ToLocationEntity(dtoResult));

            FillChildren();

            return(CurrentCollection);
        }