public IQueryable <RainfallStation> GetByRect(double x1, double x2, double y1, double y2) { var func = LonLatHelper.GetExpressionLonLatInRect(x1, x2, y1, y2); var q = from r in this._repository.Table where LonLatHelper.GetLonLatIsInRect(x1, x2, y1, y2, r.Lon, r.Lat) select r; return(q); }
public Expression <Func <Comprehensive, Boolean> > GetExpressionByRect( double x1, double x2, double y1, double y2) { //var eps = DynamicLinqExpressions.True<Comprehensive>(); //eps = eps.And(a => // LonLatHelper.ConvertToDegreeStyleFromString(a.经度) > y1 && // LonLatHelper.ConvertToDegreeStyleFromString(a.经度) < y2 && // LonLatHelper.ConvertToDegreeStyleFromString(a.纬度) > x1 && // LonLatHelper.ConvertToDegreeStyleFromString(a.纬度) < x2); //return eps; var eps = DynamicLinqExpressions.True <Comprehensive>(); eps = eps.And( c => LonLatHelper.GetLonLatIsInRect( x1, x2, y1, y2 , c.经度 , c.纬度 ) ); return(eps); }