public IList<Facility> GetAllByDistance(LatLng location, double radius, int page, int pageSize, out int totalCount) { using (PSS2012DataContext context = this.DataContext) { var facilitiesAll = this.GetAllFacilityByDistance(context, location, radius); return this.ExcludePausedAccounts(context, facilitiesAll).GetPage<Facility>(page, pageSize, out totalCount); } }
public IList<Facility> GetAllByDistanceFilter(IEnumerable<Offering> offerings, LatLng location, double radius, bool wideSearch, int page, int pageSize, out int totalCount) { using (PSS2012DataContext context = this.DataContext) { var search = this.GetAllFacilityByDistance(context, location, radius); return this.TypeOfCareIntersect(context, this.ExcludePausedAccounts(context, search), offerings, wideSearch) .GetPage<Facility>(page, pageSize, out totalCount); } }
private IQueryable<Facility> GetAllFacilityByDistance(PSS2012DataContext context, LatLng location, double radius) { var facilities = context.Facilities.Where(f => context.ufn_Haversine(location.Latitude, location.Longitude, f.Latitude, f.Longitude) < radius); return facilities; }