///// <summary> ///// Dictionary for ISO codes for territories. We may be able to set codes for all ///// territories, but the intent for now is to have it for countries only. ///// Key: Id of TerritoryInternalRecord ///// Value: Alpha-2 ISO 3166-1 code ///// </summary> //public IDictionary<int, string> TerritoryISOCode { get; set; } public void InitializeTerritories() { TopLevel = CountriesHierarchy.TopLevel // Create the top level and recursively create the whole hierarchy .Select(ci => { var tp = ci.As <TerritoryPart>(); return(tp != null ? new AddressConfigurationTerritoryViewModel( tp, SelectedCountries, SelectedProvinces, SelectedCities) : null); }) // remove nulls (sanity check) .Where(tvm => tvm != null); // Initialize the dictionaries we'll use to edit the configuration TerritoryTypeMap = new Dictionary <int, TerritoryAdministrativeType>(); foreach (var territory in CountriesHierarchy.Record.Territories) { var tType = TerritoryAdministrativeType.None; var internalId = territory.TerritoryInternalRecord.Id; if (SelectedCountries.Contains(internalId)) { tType = TerritoryAdministrativeType.Country; } else if (SelectedProvinces.Contains(internalId)) { tType = TerritoryAdministrativeType.Province; } else if (SelectedCities.Contains(internalId)) { tType = TerritoryAdministrativeType.City; } TerritoryTypeMap.Add(internalId, tType); //var iso = CountryCodes // // default is a struct with ISOCode = null // .FirstOrDefault(cc => cc.TerritoryId == internalId) // .ISOCode ?? string.Empty; //TerritoryISOCode.Add(internalId, iso); } }
public void PrintSummary() { Summary = string.Join(", ", SelectedCountries.Select(c => c.ToString())); }