/// <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); }
//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)); } }
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); } }
//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); } }
/// <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 { } }
//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(); }
private void populateCountry() { this.cbReceivingCountry.Items.Clear(); IEnumerable <RECEIVINGCOUNTRY> countries = QueryLayer.ListOfValues.ReceivingCountries(); this.cbReceivingCountry.Items.Add(new ListItem(Resources.GetGlobal("Common", "AllReceivingCountries"), WasteReceiverFilter.AllCountriesID.ToString())); List <ListItem> items = new List <ListItem>(); foreach (RECEIVINGCOUNTRY c in countries) { items.Add(new ListItem(LOVResources.CountryName(c.Code), c.LOV_CountryID.ToString())); } items.Sort(new ListItemComparer()); this.cbReceivingCountry.Items.AddRange(items.ToArray()); setSelectedCountry(); }
//creates header for waste receiver and adds to dictionary protected static void addWasteReceiver(Dictionary <string, string> header, WasteReceiverFilter filter) { if (filter != null) { string key = Resources.GetGlobal("Common", "ReceivingCountry"); string value = String.Empty; if (filter.CountryID == -1) { value = Resources.GetGlobal("Common", "AllReceivingCountries"); } else { string code = ListOfValues.GetCountry((int)filter.CountryID).Code; value = LOVResources.CountryName(code); } header.Add(key, value); } }
protected string GetCountryName(object obj) { return(LOVResources.CountryName(GetCountryCode(obj))); }
protected string GetCountryName(object obj) { WasteTransfers.ResultHazardousWasteRecievingCountry row = (WasteTransfers.ResultHazardousWasteRecievingCountry)obj; return(LOVResources.CountryName(row.RecievingCountryCode, Resources.GetGlobal("Common", "CONFIDENTIAL"))); }
protected string GetCountryName(object obj) { FacilityRow row = (FacilityRow)obj; return(LOVResources.CountryName(row.CountryCode)); }
protected string GetCountryToolTip(object obj) { return(LOVResources.CountryName(((WasteTransfers.ResultFacility)obj).CountryCode)); }
public string GetCountryToolTip(object obj) { PollutantReleases.ResultFacility row = (PollutantReleases.ResultFacility)obj; return(LOVResources.CountryName(row.CountryCode)); }
public int Compare(object x, object y) { AreaTreeListRow row1 = x as AreaTreeListRow; AreaTreeListRow row2 = y as AreaTreeListRow; //if all codes are the same the rows are identical. if (row1.CountryCode == row2.CountryCode && row1.RegionCode == row2.RegionCode) { return(0); } //total row must always be last if (row1.Code.Equals(AreaTreeListRow.CODE_TOTAL)) { return(1); } if (row2.Code.Equals(AreaTreeListRow.CODE_TOTAL)) { return(-1); } if (row1.Code.Equals(AreaTreeListRow.CODE_TOTAL) && row2.Code.Equals(AreaTreeListRow.CODE_TOTAL)) { return(0); } CaseInsensitiveComparer c = new CaseInsensitiveComparer(); //compare country names int res = c.Compare(LOVResources.CountryName(row1.CountryCode), LOVResources.CountryName(row2.CountryCode)); //if country names are the same, compare region names if (res == 0) { //country must always come first if (row1.RegionCode == null) { return(-1); } if (row2.RegionCode == null) { return(1); } if (row1.RegionCode == null && row2.RegionCode == null) { return(0); } if (res == 0) { //unknown region must always be last if (row1.Code.Equals(AreaTreeListRow.CODE_UNKNOWN)) { return(1); } if (row2.Code.Equals(AreaTreeListRow.CODE_UNKNOWN)) { return(-1); } if (row1.Code.Equals(AreaTreeListRow.CODE_UNKNOWN) && row2.Code.Equals(AreaTreeListRow.CODE_UNKNOWN)) { return(0); } //compare names res = c.Compare(row1.GetAreaName(this.areaFilter), row2.GetAreaName(this.areaFilter)); } } return(res); }
protected string GetReceivingCountry(object obj) { FACILITYDETAIL_WASTETRANSFER row = (FACILITYDETAIL_WASTETRANSFER)obj; return(ConfidentialFormat.Format(LOVResources.CountryName(row.WHPCountryCode), row.ConfidentialIndicator)); }