コード例 #1
0
        public static List <String> GetCountryListExt()
        {
            var country = new List <string> ();

            var enUs = CultureInfo.GetCultureInfo("en-US");
            var additionalCountries = new List <KeyValuePair <int, string> >
            {
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Gambia", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Ghana", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfCyprus", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_SierraLeone", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Tanzania", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Zambia", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMadagascar", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_SolomonIslands", enUs)),
                new KeyValuePair <int, string>(2072, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMoldova", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMauritius", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_BurkinaFaso", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMozambique", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfMalawi", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Benin", enUs)),
                new KeyValuePair <int, string>(12300, CRMCommonResource.ResourceManager.GetString("Country_IvoryCoast", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Bahamas", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_Andorra", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_BritishVirginIslands", enUs)),
                new KeyValuePair <int, string>(9228, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfCongo", enUs)),
                new KeyValuePair <int, string>(0, CRMCommonResource.ResourceManager.GetString("Country_RepublicOfCuba", enUs))
            };                            //https://msdn.microsoft.com/en-us/goglobal/bb964664

            var additionalCountriesCodes = additionalCountries.Select(s => s.Key).Where(s => s != 0).ToList();


            var standardCountries = Global.GetCountryListBase()
                                    .Where(s => !additionalCountriesCodes.Contains(s.Key)).ToList();

            country.AddRange(additionalCountries.Select(s => s.Value).ToList());
            country.AddRange(standardCountries.Select(s => s.Value).Distinct().ToList());
            country = country.Distinct().OrderBy(c => c).ToList();

            return(country);
        }