private static Expression <Func <WASTETRANSFER, bool> > getLambdaExpression(WasteTransferTimeSeriesFilter filter) { ParameterExpression param = Expression.Parameter(typeof(WASTETRANSFER), "s"); Expression exp = LinqExpressionBuilder.GetLinqExpressionWasteTransfer(filter, param, false); Expression <Func <WASTETRANSFER, bool> > lambda = Expression.Lambda <Func <WASTETRANSFER, bool> >(exp, param); return(lambda); }
//Table only contains confidential data private static Expression <Func <WASTETRANSFER_CONFIDENTIAL, bool> > getLambdaExpressionConfidential(WasteTransferTimeSeriesFilter filter) { ParameterExpression param = Expression.Parameter(typeof(WASTETRANSFER_CONFIDENTIAL), "s"); Expression exp = LinqExpressionBuilder.GetLinqExpressionWasteTransfer(filter, param, true); Expression <Func <WASTETRANSFER_CONFIDENTIAL, bool> > lambda = Expression.Lambda <Func <WASTETRANSFER_CONFIDENTIAL, bool> >(exp, param); return(lambda); }
// ---------------------------------------------------------------------------------- // Map filters // ---------------------------------------------------------------------------------- #region Map /// <summary> /// returns the MapFilter (sql and sectors) corresponding to the filter. The map always uses the WASTETRANSFER table for lookup /// </summary> public static MapFilter GetMapFilter(WasteTransferTimeSeriesFilter filter) { //parameter must be "p" to match map config file ParameterExpression param = Expression.Parameter(typeof(WASTETRANSFER), "p"); Expression exp = LinqExpressionBuilder.GetLinqExpressionWasteTransfer(filter, param, false); Expression <Func <WASTETRANSFER, bool> > lambda = Expression.Lambda <Func <WASTETRANSFER, bool> >(exp, param); // create sql and sectors to map. Do not remove parameter prefix. MapFilter mapFilter = new MapFilter(); mapFilter.SqlWhere = LinqExpressionBuilder.GetSQL(lambda.Body, null); mapFilter.SetLayers(filter.ActivityFilter); return(mapFilter); }