/// <summary> /// get lambda for confidential pollutant transfers /// </summary> private static Expression <Func <POLLUTANTRELEASE, bool> > getPollutantReleasesConfidentialLambda(DataClassesPollutantReleaseDataContext db, IndustrialActivitySearchFilter filter, bool includePollutant) { ParameterExpression param = Expression.Parameter(typeof(POLLUTANTRELEASE), "s"); PollutantReleaseSearchFilter filterReleases = FilterConverter.ConvertToPollutantReleaseSearchFilter(filter); Expression exp = LinqExpressionBuilder.GetLinqExpressionPollutantReleasesConfidential(filterReleases, param, includePollutant); Expression <Func <POLLUTANTRELEASE, bool> > lambda = Expression.Lambda <Func <POLLUTANTRELEASE, bool> >(exp, param); return(lambda); }
/// <summary> /// invoke pollutant search search for this row /// </summary> protected void onPollutantSearchClick(object sender, CommandEventArgs e) { // create pollutant search filter PollutantReleaseSearchFilter filter = FilterConverter.ConvertToPollutantReleaseSearchFilter(SearchFilter); // create pollutant filter filter.PollutantFilter = getPollutantFilter(e); // set medium filter filter.MediumFilter = getMediumFilter(e); // go to pollutant release LinkSearchRedirecter.ToPollutantReleases(Response, filter); }
private void populateMediumSelector() { MediumFilter mf = new MediumFilter(); mf.ReleasesToAir = true; mf.ReleasesToSoil = true; mf.ReleasesToWater = true; var filter = FilterConverter.ConvertToPollutantReleaseSearchFilter(SearchFilter); var counts = PollutantReleases.GetFacilityCounts(filter); this.ucMediumSelector.PopulateMediumRadioButtonList(mf, counts); }
/// <summary> /// return total list of areas /// </summary> public static IEnumerable <IAReleasesTreeListRow> GetPollutantReleases(IndustrialActivitySearchFilter filter) { DataClassesPollutantReleaseDataContext db = getPollutantReleaseDataContext(); ParameterExpression param = Expression.Parameter(typeof(POLLUTANTRELEASE), "s"); PollutantReleaseSearchFilter filterRelease = FilterConverter.ConvertToPollutantReleaseSearchFilter(filter); Expression exp = LinqExpressionBuilder.GetLinqExpressionPollutantReleases(filterRelease, param); Expression <Func <POLLUTANTRELEASE, bool> > lambda = Expression.Lambda <Func <POLLUTANTRELEASE, bool> >(exp, param); int facilitiesCount = 0; List <IAReleasesTreeListRow> pollutants = getReleases(db, lambda, out facilitiesCount).ToList <IAReleasesTreeListRow>(); filter.Count = facilitiesCount; return(pollutants); }
// --------------------------------------------------------------------------------------------------- // Facility couting // --------------------------------------------------------------------------------------------------- #region Facility counting /// <summary> /// Returns the number of facilities for each medium type. /// </summary> public static PollutantReleases.FacilityCountObject GetFacilityCounts(PollutantReleasesTimeSeriesFilter tsFilter) { // removes all year span information var filter = FilterConverter.ConvertToPollutantReleaseSearchFilter(tsFilter); ParameterExpression param = Expression.Parameter(typeof(POLLUTANTRELEASE), "POLLUTANTRELEASE"); Expression exp = LinqExpressionBuilder.GetLinqExpressionPollutantReleases(filter, param); // Exclude EPER reporting years Expression prop = Expression.Property(param, "ReportingYear"); Expression val = Expression.Constant(2007); Expression yearExp = Expression.GreaterThanOrEqual(prop, val); exp = Expression.AndAlso(yearExp, exp); Expression <Func <POLLUTANTRELEASE, bool> > lambda = Expression.Lambda <Func <POLLUTANTRELEASE, bool> >(exp, param); return(PollutantReleases.GetFacilityCounts(lambda, filter.MediumFilter)); }