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); }
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); }
/// <summary> /// creates header for Area and adds to dictionary /// </summary> protected static void addActivity(Dictionary <string, string> header, ActivityFilter filter) { if (filter != null) { // set the key string key; switch (filter.ActivityType) { case ActivityFilter.Type.AnnexI: key = Resources.GetGlobal("Activity", "AnnexI"); break; case ActivityFilter.Type.NACE: key = Resources.GetGlobal("Activity", "NACE"); break; case ActivityFilter.Type.IPPC: key = Resources.GetGlobal("Activity", "IPPC"); break; default: key = ""; break; } // set the value string value = string.Empty; ActivityFilter.Level level = filter.SearchLevel(); if (level == ActivityFilter.Level.All) { value = Resources.GetGlobal("Common", "AllSectors"); } else { switch (filter.ActivityType) { case ActivityFilter.Type.AnnexI: { value = GetActivityAnnexI(filter); break; } case ActivityFilter.Type.NACE: { value = GetActivityNACE(filter); break; } case ActivityFilter.Type.IPPC: { //value = GetActivityIPPC(filter); break; } default: { break; } } } header.Add(key, value); } }