Пример #1
0
        /// <summary>
        /// GetPollutantFilter
        /// </summary>
        public static PollutantFilter GetPollutantFilter(string code, int level)
        {
            PollutantFilter filter    = new PollutantFilter();
            LOV_POLLUTANT   pollutant = ListOfValues.GetPollutant(code);

            if (level == 1)
            {
                if (pollutant.ParentID != null)
                {
                    filter.PollutantID      = pollutant.LOV_PollutantID;
                    filter.PollutantGroupID = pollutant.ParentID.Value;
                }
                else
                {
                    // confidential in group, same id
                    filter.PollutantID      = pollutant.LOV_PollutantID;
                    filter.PollutantGroupID = pollutant.LOV_PollutantID;
                }
            }
            else if (level == 0)
            {
                filter.PollutantID      = PollutantFilter.AllPollutantsInGroupID;
                filter.PollutantGroupID = pollutant.LOV_PollutantID;
            }

            return(filter);
        }
Пример #2
0
    protected void lvColHeaders_OnDataBinding(object sender, EventArgs e)
    {
        Label lbActivity = ((ListView)sender).FindControl("lbActivity") as Label;

        int           pollutantGroupID = getPollutantGroupID();
        LOV_POLLUTANT group            = ListOfValues.GetPollutant(pollutantGroupID);

        if (lbActivity != null && group != null)
        {
            lbActivity.Text = String.Format(Resources.GetGlobal("AreaOverview", "ReleasesOf"), LOVResources.PollutantGroupName(group.Code));
        }
    }
Пример #3
0
    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);
    }
    public void Populate(PollutantTransferTimeSeriesFilter filter, bool hasConfidentialInformation)
    {
        SearchFilter = filter;

        LOV_POLLUTANT pollutant = ListOfValues.GetPollutant(filter.PollutantFilter.PollutantID);

        PollutantCode = pollutant != null ? pollutant.Code : null;

        //set parentcode
        ParentCode = null;
        if (pollutant != null && pollutant.ParentID != null)
        {
            LOV_POLLUTANT pollutantGroup = ListOfValues.GetPollutant(pollutant.ParentID.Value);
            ParentCode = pollutantGroup != null ? pollutantGroup.Code : null;
        }

        this.divConfidentialityInformation.Visible   = hasConfidentialInformation;
        this.divNoConfidentialityInformation.Visible = !hasConfidentialInformation;

        showContent(filter);
    }
    public void Populate(int facilityId, string pollutantCode)
    {
        PollutantCode = pollutantCode;
        //set parentcode
        LOV_POLLUTANT pollutant = ListOfValues.GetPollutant(pollutantCode);

        ParentCode = null;
        if (pollutant != null && pollutant.ParentID != null)
        {
            LOV_POLLUTANT pollutantGroup = ListOfValues.GetPollutant(pollutant.ParentID.Value);
            ParentCode = pollutantGroup != null ? pollutantGroup.Code : null;
        }

        List <TimeSeriesClasses.ConfidentialityPollutant> data = PollutantTransferTrend.GetConfidentialTimeSeries(facilityId, pollutantCode);
        bool hasConfidentialInformation = data.Any();

        this.divConfidentialityInformation.Visible   = hasConfidentialInformation;
        this.divNoConfidentialityInformation.Visible = !hasConfidentialInformation;

        this.lvConfidentiality.Visible    = true;
        this.lvConfidentiality.DataSource = data;
        this.lvConfidentiality.DataBind();
    }
    public void Populate(PollutantReleasesTimeSeriesFilter filter, bool hasConfidentialInformation, MediumFilter.Medium medium)
    {
        SearchFilter = filter;

        LOV_POLLUTANT pollutant = ListOfValues.GetPollutant(filter.PollutantFilter.PollutantID);

        PollutantCode = pollutant != null ? pollutant.Code : null;

        //set parentcode
        ParentCode = null;
        if (pollutant != null && pollutant.ParentID != null)
        {
            LOV_POLLUTANT pollutantGroup = ListOfValues.GetPollutant(pollutant.ParentID.Value);
            ParentCode = pollutantGroup != null ? pollutantGroup.Code : null;
        }

        this.ucMediumSelector.Visible = hasConfidentialInformation;

        if (hasConfidentialInformation)
        {
            var count = PollutantReleaseTrend.GetFacilityCounts(filter);
            this.ucMediumSelector.PopulateMediumRadioButtonList(filter.MediumFilter, medium, count);
        }
    }
Пример #7
0
        /// <summary>
        /// Gets the name of a Pollutant group based on the id
        /// </summary>
        public static string PollutantGroupName(int id)
        {
            LOV_POLLUTANT group = ListOfValues.GetPollutant(id);

            return(PollutantGroupName(group.Code));
        }
Пример #8
0
                    public Map(string layerId, string cmsLayerId, MediumFilter.Medium medium, string pollutantCode, List <string> activityCodes, int year)
                    {
                        this.LayerId    = layerId;
                        this.CmsLayerId = cmsLayerId;
                        this.Medium     = medium;

                        //year
                        filter.YearFilter = new YearFilter {
                            Year = year
                        };

                        //set pollutant filter
                        LOV_POLLUTANT pollutant = ListOfValues.GetPollutant(pollutantCode);

                        filter.PollutantFilter                  = new PollutantFilter();
                        filter.PollutantFilter.PollutantID      = pollutant.LOV_PollutantID;
                        filter.PollutantFilter.PollutantGroupID = (int)pollutant.ParentID;

                        //set medium filter
                        filter.MediumFilter = new MediumFilter();
                        switch (medium)
                        {
                        case MediumFilter.Medium.Air:
                            filter.MediumFilter.ReleasesToAir = true;
                            break;

                        case MediumFilter.Medium.Soil:
                            filter.MediumFilter.ReleasesToSoil = true;
                            break;

                        case MediumFilter.Medium.Water:
                            filter.MediumFilter.ReleasesToWater = true;
                            break;

                        default:
                            filter.MediumFilter = null;
                            break;
                        }

                        //set activity filter
                        if (activityCodes.Count > 0)
                        {
                            IEnumerable <LOV_ANNEXIACTIVITY> activities = ListOfValues.GetAnnexIActivities(activityCodes);
                            filter.ActivityFilter = new ActivityFilter();
                            filter.ActivityFilter.ActivityType   = ActivityFilter.Type.AnnexI;
                            filter.ActivityFilter.SectorIds      = activities.Select(a => (int)a.ParentID).ToList <int>();
                            filter.ActivityFilter.ActivityIds    = activities.Select(a => a.LOV_AnnexIActivityID).ToList <int>();
                            filter.ActivityFilter.SubActivityIds = new List <int>()
                            {
                                ActivityFilter.AllSubActivitiesInActivityID
                            };
                        }

                        //create mapfilter for expanded map
                        this.MapFilterExpanded = QueryLayer.PollutantReleases.GetMapFilter(filter);

                        if (activityCodes.Count > 0)
                        {
                            this.MapFilterExpanded.Layers = String.Format("facilities,{0}", LayerId); //Don't show any layers as default
                        }
                        else
                        {
                            this.MapFilterExpanded.Layers = LayerId;
                        }

                        this.MapFilterExpanded.VisibleLayers = LayerId; //only turn on diffuse layer

                        //create mapfilter for small map (does not show facilities)
                        this.MapFilterSmall        = new MapFilter();
                        this.MapFilterSmall.Layers = LayerId;
                    }