public static string GetAreaName(this TreeListRow row, AreaFilter areaFilter) { switch (row.Level) { case 0: //country return(LOVResources.CountryName(row.Code)); case 1: //River absin district or NUTS { AreaFilter.RegionType type = areaFilter.TypeRegion; if (type == AreaFilter.RegionType.RiverBasinDistrict) { return(LOVResources.RiverBasinDistrictName(row.Code)); } else { return(LOVResources.NutsRegionName(row.Code)); } } default: return(string.Empty); } }
protected string GetActivityName(object obj) { FacilityRow row = (FacilityRow)obj; //return LOVResources.AnnexIActivityName(row.ActivityCode); return((LOVResources.AnnexIActivityName(row.ActivityCode)).Replace("EPER_", "")); }
/// <summary> /// Save transfers data /// </summary> protected void doSave(object sender, EventArgs e) { try { CultureInfo csvCulture = CultureResolver.ResolveCsvCulture(Request); CSVFormatter csvformat = new CSVFormatter(csvCulture); // Create Header var header = CsvHeaderBuilder.GetTsPollutantTransfersSearchHeader(SearchFilter, ConfidentialityAffected); var data = PollutantTransferTrend.GetTimeSeries(SearchFilter); var pollutant = ListOfValues.GetPollutant(SearchFilter.PollutantFilter.PollutantID); string pollutantName = LOVResources.PollutantName(pollutant.Code); // dump to file string topheader = csvformat.CreateHeader(header); string rowheaders = csvformat.GetPollutantTransfersTimeSeriesHeader(); Response.WriteUtf8FileHeader("EPRTR_Pollutant_Transfers_Time_Series"); Response.Write(topheader + rowheaders); foreach (var v in data) { string row = csvformat.GetPollutantTransfersTimeSeriesRow(v, pollutantName); Response.Write(row); } Response.End(); } catch { } }
//creates header for Pollutant group and adds to dictionary protected static void addPollutantGroup(Dictionary <string, string> header, int pollutantGroupId) { string key = Resources.GetGlobal("Common", "PollutantGroup"); string value = LOVResources.PollutantGroupName(pollutantGroupId); header.Add(key, value); }
//creates header for facility country and adds to dictionary protected static void addFacilityCountry(Dictionary <string, string> header, Facility.FacilityBasic basic) { if (basic != null) { header.Add(Resources.GetGlobal("Common", "Country"), LOVResources.CountryName(basic.CountryCode)); } }
/// <summary> /// Save /// </summary> protected void doSave(object sender, EventArgs e) { try { CultureInfo csvCulture = CultureResolver.ResolveCsvCulture(Request); CSVFormatter csvformat = new CSVFormatter(csvCulture); // Create Header bool confidentialityAffected = PollutantTransferTrend.IsAffectedByConfidentiality(FacilityBasic.FacilityID, PollutantCode); Dictionary <string, string> header = CsvHeaderBuilder.GetFacilityTrendHeader(FacilityBasic.FacilityReportId, true); // Create Body string pollutantName = LOVResources.PollutantName(PollutantCode); List <TimeSeriesClasses.PollutantTransfers> data = getTimeSeriesData(FacilityBasic.FacilityID, PollutantCode); // dump to file string topheader = csvformat.CreateHeader(header); string pollutantHeader = csvformat.GetPollutantTransfersTrendHeader(); Response.WriteUtf8FileHeader("EPRTR_Pollutant_Transfers_Time_Series"); Response.Write(topheader + pollutantHeader); foreach (var v in data) { string row = csvformat.GetPollutantTransfersTrendRow(v, pollutantName); Response.Write(row); } Response.End(); } catch { } }
//creates header for Pollutant filter and adds to dictionary protected static void addPollutant(Dictionary <string, string> header, PollutantFilter filter) { if (filter != null) { string key = Resources.GetGlobal("Common", "Pollutant"); string value = string.Empty; PollutantFilter.Level level = filter.SearchLevel(); if (level == PollutantFilter.Level.All) { value = Resources.GetGlobal("Common", "AllPollutants"); } else if (level == PollutantFilter.Level.PollutantGroup) { value = LOVResources.PollutantGroupName(ListOfValues.GetPollutant(filter.PollutantGroupID).Code); } else { value = LOVResources.PollutantName(ListOfValues.GetPollutant(filter.PollutantID).Code); } header.Add(key, value); } }
protected void OnConfDatabinding(object sender, EventArgs args) { Control headerGroup = this.lvConfidentiality.FindControl("divPollutantGroupHeader"); headerGroup.Visible = ShowGroup; string pollutantCode = PollutantCode; if (!String.IsNullOrEmpty(pollutantCode)) { Label lbPollutant = this.lvConfidentiality.FindControl("lbPollutant") as Label; if (lbPollutant != null) { lbPollutant.Text = LOVResources.PollutantName(pollutantCode); } } if (ShowGroup) { Label lbPollutantGroup = this.lvConfidentiality.FindControl("lbPollutantGroup") as Label; if (lbPollutantGroup != null) { lbPollutantGroup.Text = LOVResources.PollutantName(ParentCode); } } }
private void populatePollutants() { this.cbPollutant.Items.Clear(); //int startYear = 2001; int endYear = 2004; int groupID = Convert.ToInt32(this.cbPollutantGroup.SelectedItem.Value); IEnumerable <LOV_POLLUTANT> pollutants = QueryLayer.ListOfValues.GetLeafPollutants(groupID).Where(x => x.EndYear != endYear); //.Where(x => x.StartYear >= startYear); if (includeAll) { this.cbPollutant.Items.Add(new ListItem(Resources.GetGlobal("Common", "AllPollutants"), PollutantFilter.AllPollutantsInGroupID.ToString())); } foreach (LOV_POLLUTANT p in pollutants) { this.cbPollutant.Items.Add(new ListItem(LOVResources.PollutantName(p.Code), p.LOV_PollutantID.ToString())); } //add option for confidential within group if (groupID != PollutantFilter.AllGroupsID) { this.cbPollutant.Items.Add(new ListItem(Resources.GetGlobal("Common", "ConfidentialInGroup"), groupID.ToString())); } setSelectedPollutant(); }
/// <summary> /// Used on the Bubblechart /// </summary> /// <param name="data"></param> /// <returns></returns> private static EPRTRT.DataContracts.WasteTransferBoundaries PopulateBubblechartDataContract(IEnumerable <WasteTransfers.TransboundaryHazardousWasteData> data) { IEnumerable <WasteTransfers.TransboundaryHazardousWasteData> bubbleData = prepareBubblechartData(data); EPRTRT.DataContracts.WasteTransferBoundaries myWasteTransferBoundaries = new EPRTRT.DataContracts.WasteTransferBoundaries(); foreach (var item in bubbleData) { //translate toCountry name for "other" string toCountry = item.TransferTo; if (WasteTransfers.TransboundaryHazardousWasteData.OTHER.Equals(toCountry)) { toCountry = LOVResources.CountryName(toCountry); } EPRTRT.DataContracts.WasteTransferBoundary myWasteTB = new EPRTRT.DataContracts.WasteTransferBoundary() { FromCountry = item.TransferFrom, ToCountry = toCountry, DoubleCounting = item.TransferTo, //doubleCounting is used to hold the code of the receiving country Total = convertToString(item.Total), Facilities = item.Facilities.ToString(), Recovery = convertToString(item.Recovery), Disposal = convertToString(item.Disposal), Name = LOVResources.CountryName(item.TransferTo), PercentEUTotal = convertToString(item.UnSpecified) //PercentEUTotal is used for transferring the unspecified }; myWasteTransferBoundaries.Add(myWasteTB); } return(myWasteTransferBoundaries); }
protected string GetPollutantName(object obj) { FACILITYDETAIL_POLLUTANTTRANSFER row = (FACILITYDETAIL_POLLUTANTTRANSFER)obj; string codeEPER = row.PollutantCode + "EPER"; //return LOVResources.PollutantName(row.PollutantCode); return(LOVResources.PollutantNameEPER(row.PollutantCode, codeEPER)); }
protected string GetTreatment(object obj) { WasteTransfers.ResultHazardousWasteTreater row = (WasteTransfers.ResultHazardousWasteTreater)obj; string treatmentCode = row.Treatment == null ? "U" : row.Treatment; return(LOVResources.WasteTreatmentName(treatmentCode)); }
//creates header for waste receiver and adds to dictionary protected static void addWasteReceiver(Dictionary <string, string> header, string countryCode) { if (!String.IsNullOrEmpty(countryCode)) { string key = Resources.GetGlobal("Common", "ReceivingCountry"); string value = LOVResources.CountryName(countryCode); header.Add(key, value); } }
//creates header for regulation (legal name) used in reporting and adds to dictionary protected static void addLegalRegulation(Dictionary <string, string> header, int reportingYear) { string key = Resources.GetGlobal("Common", "Regulation"); string code = ListOfValues.GetRegulationCode(reportingYear); string value = LOVResources.LegalRegulationName(code); header.Add(key, value); }
private static string GetActivityAnnexI(ActivityFilter filter) { ActivityFilter.Level level = filter.SearchLevel(); // return value: string describing the activity string value = ""; if (level == ActivityFilter.Level.Sector) { if (filter.SectorIds.Count() == 1) { value = LOVResources.AnnexIActivityName(filter.SectorIds.First()); } else { value = Resources.GetGlobal("Common", "SeveralSectors"); } } else if (level == ActivityFilter.Level.Activity) { if (filter.ActivityIds.Count() == 1) { value = LOVResources.AnnexIActivityName(filter.ActivityIds.First()); } else { //only only sector will be selected string sector = LOVResources.AnnexIActivityName(filter.SectorIds.First()); value = string.Format(Resources.GetGlobal("Common", "SeveralActivities"), sector); } } else if (level == ActivityFilter.Level.SubActivity) { if (filter.SubActivityIds.Count() == 1) { int id = filter.SubActivityIds.First(); if (id.Equals(ActivityFilter.SubActivitiesUnspecifiedID)) { value = Resources.GetGlobal("Common", "Unspecified"); } else { value = LOVResources.AnnexIActivityName(id); } } else { //only one activity will be selected string activity = LOVResources.AnnexIActivityName(filter.ActivityIds.First()); value = string.Format(Resources.GetGlobal("Common", "SeveralSubActivities"), activity); } } return(value); }
protected static void addPollutantEPER(Dictionary <string, string> header, string pollutantCodeEPER, string pollutantCode) { if (!string.IsNullOrEmpty(pollutantCode)) { string key = Resources.GetGlobal("Common", "ContentEmissions"); string value = LOVResources.PollutantNameEPER(pollutantCode, pollutantCodeEPER); header.Add(key, value); } }
/// <summary> /// Returnes a combined address string. The country will be translated. /// </summary> /// <param name="address">adress, i.e. steetname incl. buildingnumber</param> /// <param name="city"></param> /// <param name="postalCode"></param> /// <param name="countryCode">The LOV code for the country</param> /// <param name="confidential">True if confidentality is claimed</param> public static string Format(string address, string city, string postalCode, string countryCode, bool confidential) { string result = address; result = addString(result, postalCode); result = addString(result, city); result = addString(result, LOVResources.CountryName(countryCode)); return(ConfidentialFormat.Format(result, confidential)); }
/// <summary> /// Save /// </summary> /// public void DoSaveCSV(object sender, EventArgs e) { try { CultureInfo csvCulture = CultureResolver.ResolveCsvCulture(Request); CSVFormatter csvformat = new CSVFormatter(csvCulture); // Create Header FacilitySearchFilter filter = SearchFilter; bool isConfidentialityAffected = Facility.IsAffectedByConfidentiality(filter); Dictionary <string, string> header = CsvHeaderBuilder.GetFacilitySearchHeader( filter, isConfidentialityAffected); // Create Body List <Facility.FacilityCSV> facilities = Facility.GetFacilityListCSV(filter); // dump to file string topheader = csvformat.CreateHeader(header).Replace("E-PRTR", "EPER"); string facilityHeader = csvformat.GetFacilityHeader(); string url = Request.Url.AbsoluteUri; url = url.Substring(0, url.LastIndexOf("/") + 1); Response.WriteUtf8FileHeader("EPER_Facility_List"); Response.Write(topheader + facilityHeader); foreach (var v in facilities) { // translate codes v.ActivityName = LOVResources.AnnexIActivityName(v.ActivityCode); v.CountryName = LOVResources.CountryName(v.CountryCode); v.NutsRegionName = LOVResources.NutsRegionName(v.NutsRegionCode); v.RiverBasinName = LOVResources.RiverBasinDistrictName(v.RiverBasinCode); v.FacilityName = ConfidentialFormat.Format(v.FacilityName, v.Confidential); v.PostalCode = ConfidentialFormat.Format(v.PostalCode, v.Confidential); v.Address = ConfidentialFormat.Format(v.Address, v.Confidential); v.City = ConfidentialFormat.Format(v.City, v.Confidential); v.URL = String.Format("{0}/PopupFacilityDetails.aspx?FacilityReportId={1}", url, v.FacilityReportID); string row = csvformat.GetFacilityRow(v); Response.Write(row); } Response.End(); } catch { } }
/// <summary> /// Initialize the bars. /// </summary> /// <param name="series">The number of series to include in the bar chart</param> /// <param name="type">The type of time series chart</param> /// <param name="barcolors">The colors to use for the series. The number of colors given must corresponds to the number of series</param> /// <param name="barHatchStyles">The hatchstyles to use for the series. The number of styles given must corresponds to the number of series</param> /// <param name="legendTexts">The texts to be shown in the legends. If null, no legends will be shown</paparam> /// <param name="unitCode">The unit code corresponding to the y-axis</param> public void Initialize(int series, StackColumnType type, string unitCode, Color[] barColors, ChartHatchStyle[] barHatchStyles, string[] legendTexts) { if (series != barColors.Length) { throw (new ArgumentException("number of colors must correspond to the number of series")); } if (series != barHatchStyles.Length) { throw (new ArgumentException("number of hatch styles must correspond to the number of series")); } if (legendTexts != null && series != legendTexts.Length) { throw (new ArgumentException("number of legend tetxs must correspond to the number of series")); } //set in view state this.Type = type; setAxisYTitle(LOVResources.UnitName(unitCode)); setFont(); setLegendStyle(type); //add series and legends this.stackcolumn.Series.Clear(); this.stackcolumn.Legends[0].CustomItems.Clear(); for (int i = 0; i < series; i++) { Series bar = this.stackcolumn.Series.Add(i.ToString()); bar.ChartType = SeriesChartType.StackedColumn; bar.Color = barColors[i]; bar.IsVisibleInLegend = false; //use custom legends instead. bar.BackHatchStyle = barHatchStyles[i]; if (legendTexts != null) { LegendItem item = new LegendItem(); item.Name = legendTexts[i]; item.SeriesName = legendTexts[i]; item.BorderColor = Color.Black; item.Color = bar.Color; item.BackHatchStyle = bar.BackHatchStyle; item.ImageStyle = LegendImageStyle.Rectangle; this.stackcolumn.Legends[0].CustomItems.Add(item); } } this.stackcolumn.Legends[0].CustomItems.Reverse(); }
//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; }
protected string GetPollutantName(object obj) { FACILITYDETAIL_POLLUTANTRELEASE row = (FACILITYDETAIL_POLLUTANTRELEASE)obj; string codeEPER = row.PollutantCode; if (!codeEPER.EndsWith("EPER")) { codeEPER = codeEPER + "EPER"; } //return LOVResources.PollutantName(row.PollutantCode); return(LOVResources.PollutantNameEPER(row.PollutantCode, codeEPER)); }
protected string GetName(object obj) { PollutantReleases.ReleasesTreeListRow row = (PollutantReleases.ReleasesTreeListRow)obj; if (row.HasChildren) //this is a pollutant group { return(LOVResources.PollutantGroupName(row.Code) + " " + GetGroupCount(row)); } else { return(LOVResources.PollutantName(row.Code)); } }
private void populatePollutantGroups() { this.cbPollutantGroup.Items.Clear(); IEnumerable <LOV_POLLUTANT> groups = QueryLayer.ListOfValues.PollutantGroups(); //Value of areas are prefixed to separate them from countries foreach (LOV_POLLUTANT g in groups) { this.cbPollutantGroup.Items.Add(new ListItem(LOVResources.PollutantGroupName(g.Code), g.LOV_PollutantID.ToString())); } this.cbPollutantGroup.SelectedIndex = 0; }
/// <summary> /// Popolate summery, flash /// </summary> public void Populate( PollutantReleaseSearchFilter filter, PollutantReleases.FacilityCountObject counts) { // remove all radios //this.rbReleaseGroup.Items.Clear(); // check that any relases are selected if (!filter.MediumFilter.ReleasesToAir && !filter.MediumFilter.ReleasesToWater && !filter.MediumFilter.ReleasesToSoil) { this.ucMediumSelector.Visible = false; this.litNoResultFound.Visible = true; this.pieChartPanel.Visible = false; return; } // let flex chart be visible this.pieChartPanel.Visible = true; this.litNoResultFound.Visible = false; // Get ALL data once for air,water,soil List <Summary.Quantity> air, water, soil; QueryLayer.PollutantReleases.Summery(filter, out air, out water, out soil); // Translate foreach (Summary.Quantity a in air) { a.Name = LOVResources.AnnexIActivityName(a.Code); } foreach (Summary.Quantity w in water) { w.Name = LOVResources.AnnexIActivityName(w.Code); } foreach (Summary.Quantity s in soil) { s.Name = LOVResources.AnnexIActivityName(s.Code); } // Store result in viewstate (small result) ViewState[DATA_AIR] = air; ViewState[DATA_WATER] = water; ViewState[DATA_SOIL] = soil; this.ucMediumSelector.PopulateMediumRadioButtonList(filter.MediumFilter, counts); }
private static string GetActivityNACE(ActivityFilter filter) { ActivityFilter.Level level = filter.SearchLevel(); // return value: string describing the activity string value = ""; if (level == ActivityFilter.Level.Sector) { if (filter.SectorIds.Count() == 1) { value = LOVResources.NaceActivityName(filter.SectorIds.First()); } else { value = Resources.GetGlobal("Common", "SeveralSectors"); } } else if (level == ActivityFilter.Level.Activity) { if (filter.ActivityIds.Count() == 1) { value = LOVResources.NaceActivityName(filter.ActivityIds.First()); } else { //only one sector is selceted string sector = LOVResources.NaceActivityName(filter.SectorIds.First()); value = string.Format(Resources.GetGlobal("Common", "SeveralActivities"), sector); } } else if (level == ActivityFilter.Level.SubActivity) { if (filter.SubActivityIds.Count() == 1) { //NACE cannot be unspecified value = LOVResources.NaceActivityName(filter.SubActivityIds.First()); } else { //only one activity is selcted string activity = LOVResources.NaceActivityName(filter.ActivityIds.First()); value = string.Format(Resources.GetGlobal("Common", "SeveralSubActivities"), activity); } } return(value); }
//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); } }
// Translate if specific country selected private void translateArea(AreaFilter filter, List <PollutantTransfers.AreaComparison> compareList) { //dont translate countries, only regions (NUTS or RBD) if (filter.SearchLevel() != AreaFilter.Level.AreaGroup) { foreach (PollutantTransfers.AreaComparison cl in compareList) { if (filter.TypeRegion == AreaFilter.RegionType.RiverBasinDistrict) { cl.Area = LOVResources.RiverBasinDistrictName(cl.Area); //RiverBasinDistrictCode } else if (filter.TypeRegion == AreaFilter.RegionType.NUTSregion) { cl.Area = LOVResources.NutsRegionName(cl.Area); //NUTS code } } } }
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); }
/// <summary> /// Save release data /// </summary> protected void doSave(object sender, EventArgs e) { try { CultureInfo csvCulture = CultureResolver.ResolveCsvCulture(Request); CSVFormatter csvformat = new CSVFormatter(csvCulture); // Check if current medium is affected confidentiality claims bool confidentialityAffected = PollutantReleaseTrend.IsAffectedByConfidentiality( SearchFilter, CurrentMedium); // Create Header var header = CsvHeaderBuilder.GetTsPollutantReleasesSearchHeader(SearchFilter, CurrentMedium, confidentialityAffected); var data = PollutantReleaseTrend.GetTimeSeries(SearchFilter, CurrentMedium); string mediumName = LOVResources.MediumName(EnumUtil.GetStringValue(CurrentMedium)); var pollutant = ListOfValues.GetPollutant(SearchFilter.PollutantFilter.PollutantID); string pollutantName = LOVResources.PollutantName(pollutant.Code); // dump to file string topheader = csvformat.CreateHeader(header); string rowheaders = csvformat.GetPollutantReleasesTimeSeriesHeader(); Response.WriteUtf8FileHeader("EPRTR_Pollutant_Releases_Time_Series"); Response.Write(topheader + rowheaders); foreach (var v in data) { string row = csvformat.GetPollutantReleasesTimeSeriesRow(v, pollutantName, mediumName); Response.Write(row); } Response.End(); } catch { } }
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(); }