Introduction
I've been working on a new Multi Channel eCommerce solution which includes accounting software (with the option of Sage). However, as eCommerce & a new Sage 200 developer, I'm always reading XML files and finding it hard to deal with country information. So I decided to country this eNum
. It provides the following details:
- Int for database
- Country code
- PhoneCode
- Country Name
All in an easy to use eNum
, making the code more HCI friendly.
Background
My idea came to a problem I always come across. Before now, I was using XML linq to read XML file each time to check for information about each country. So I decided to change this and make the code more HCI friendly which lead me to create this eNum
. This eNum
contains 204 countries.
Using the Code
I'm going to keep this nice and sweet. The code uses a custom attribute called CountryInfoAttribute
. So if you want to find "secret
" and "secret2
", then fell free to explore.
How to retrieve country name:
Country.eCountry.FalklandIslands4FverBritish.GetCountryName();
Know the country but need to know the phone number. Here's how you get the International Codes:
Country.eCountry.UnitedKingdom.GetPhoneCode();
Need to get the country code. No problem.
Country.eCountry.UnitedStates.GetCountryCode();
You know the country name but you need to get the eNum
. You can return the eNum
as well.
Country.GetEnum("Vatican City").GetCountryName();
You can also search for the enum
by the country code.
Country.GetEnum("GB").GetCountryName();
More functions will be coming soon. However, for now, these are the only things I require. As it grows, I'll keep this updated.
Points of Interest
I'm not going to deny I'm a nationalist and patriotic. As a result, some countries have secret
and secret2
Attribute value. So, if you play around with the eNum
, you might see some quirks.
History
Release 1.0
- Fetch
enum
from country code or name eNum
contains country code - Convert
enum
into an int
to allow for database input - Country name
- International phone numbers