//create pollutant headers, order by name and save in view state private void preparePollutantHeaders(AreaOverviewSearchFilter filter, MediumFilter.Medium medium, int pollutantGroupID) { List <LOV_POLLUTANT> orderedPollutants = getOrderedPollutants(filter, medium, pollutantGroupID); Dictionary <string, string> pollutantHeaders = new Dictionary <string, string>(); foreach (LOV_POLLUTANT p in orderedPollutants) { pollutantHeaders.Add(p.Code, LOVResources.PollutantNameShort(p.Code)); } ViewState[COLHEADER] = pollutantHeaders; }
private List <LOV_POLLUTANT> getOrderedPollutants(AreaOverviewSearchFilter filter, MediumFilter.Medium medium, int pollutantGroupID) { List <string> pollutantCodes = AreaOverview.GetPollutantReleasePollutantCodes(filter, medium, pollutantGroupID); IEnumerable <LOV_POLLUTANT> pollutants = ListOfValues.Pollutants(pollutantGroupID).Where(p => pollutantCodes.Contains(p.Code)); //sort by short name List <LOV_POLLUTANT> orderedPollutants = pollutants.OrderBy(p => LOVResources.PollutantNameShort(p.Code)).ToList(); //Add confidential in group to the end of the list. LOV_POLLUTANT confPollutant = ListOfValues.GetPollutant(pollutantGroupID); if (pollutantCodes.Contains(confPollutant.Code)) { orderedPollutants.Add(confPollutant); } return(orderedPollutants); }