Example #1
0
        //creates header for Area and adds to dictionary
        protected static void addArea(Dictionary <string, string> header, AreaFilter filter)
        {
            if (filter != null)
            {
                string key   = Resources.GetGlobal("Common", "Area");
                string value = string.Empty;

                AreaFilter.Level level = filter.SearchLevel();

                if (level == AreaFilter.Level.AreaGroup)
                {
                    string code = ListOfValues.GetAreaGroup((int)filter.AreaGroupID).Code;
                    value = LOVResources.AreaGroupName(code);
                }
                else if (level == AreaFilter.Level.Country)
                {
                    string code = ListOfValues.GetCountry((int)filter.CountryID).Code;
                    value = LOVResources.CountryName(code);
                }
                else if (level == AreaFilter.Level.Region)
                {
                    if (filter.TypeRegion == AreaFilter.RegionType.RiverBasinDistrict)
                    {
                        string code = ListOfValues.GetRiverBasinDistrict((int)filter.RegionID).Code;
                        value = LOVResources.RiverBasinDistrictName(code);
                    }
                    else if (filter.TypeRegion == AreaFilter.RegionType.NUTSregion)
                    {
                        if (filter.RegionID != null)
                        {
                            string code = ListOfValues.GetNUTSRegion((int)filter.RegionID).Code;
                            value = LOVResources.NutsRegionName(code);
                        }
                        else
                        {
                            value = LOVResources.NutsRegionName(TreeListRow.CODE_UNKNOWN);
                        }
                    }
                    else
                    {
                        throw new InvalidOperationException(string.Format("Illgegal RegionType {0}", filter.TypeRegion));
                    }
                }

                header.Add(key, value);
            }
        }
    private void populateAreaCountry()
    {
        this.cbFacilityCountry.Items.Clear();
        IEnumerable <LOV_AREAGROUP>    groups    = QueryLayer.ListOfValues.AreaGroups();
        IEnumerable <REPORTINGCOUNTRY> countries = QueryLayer.ListOfValues.ReportingCountries();

        //Value of areas are negative to separate them from countries
        foreach (LOV_AREAGROUP g in groups)
        {
            this.cbFacilityCountry.Items.Add(new ListItem(LOVResources.AreaGroupName(g.Code), (-g.LOV_AreaGroupID).ToString()));
        }
        foreach (REPORTINGCOUNTRY c in countries)
        {
            this.cbFacilityCountry.Items.Add(new ListItem(LOVResources.CountryName(c.Code), c.LOV_CountryID.ToString()));
        }

        setSelectedAreaCountry();

        populateRegion();
    }