Exemple #1
0
        //properties

        //methods

        /// <summary>
        /// Routine for generating the default national id of all zeros.
        /// </summary>
        /// <param name="country">Specifies the country for which the ID is to be generated.</param>
        /// <returns>Always returns string containing an all zeros national id.</returns>
        public string GetDefaultNationalId(enNationalIdCountry country)
        {
            string nationalId = "000000000";

            switch (country)
            {
            case enNationalIdCountry.UnitedStates:
                nationalId = "000-00-0000";
                break;

            case enNationalIdCountry.Canada:
                nationalId = "000-000-000";
                break;

            case enNationalIdCountry.Mexico:
                nationalId = "XXXX000000XXXXXX00";
                break;

            default:
                nationalId = "000000000";
                break;
            }

            return(nationalId);
        }
        /// <summary>
        /// Routine to generate a random (non-valid) national id.
        /// </summary>
        /// <param name="country">Country for which the random id will be formatted.</param>
        /// <param name="nameType">Specify whether name is a person or business name.</param>
        /// <returns>String containing the random national id.</returns>
        public string GetNationalId(enNationalIdCountry country, enNationalIdNameType nameType)
        {
            string nationalId = string.Empty;



            if (nameType == enNationalIdNameType.Person)
            {
                switch (country)
                {
                case enNationalIdCountry.UnitedStates:
                    nationalId = GetNationalPersonIdUS();
                    break;

                case enNationalIdCountry.Canada:
                    nationalId = GetNationalPersonIdCAN();
                    break;

                case enNationalIdCountry.Mexico:
                    nationalId = GetNationalPersonIdMEX();
                    break;

                default:
                    nationalId = "000000000";
                    break;
                }
            }
            else if (nameType == enNationalIdNameType.Business)
            {
                switch (country)
                {
                case enNationalIdCountry.UnitedStates:
                    nationalId = GetNationalBusinessIdUS();
                    break;

                case enNationalIdCountry.Canada:
                    nationalId = GetNationalBusinessIdCAN();
                    break;

                case enNationalIdCountry.Mexico:
                    nationalId = GetNationalBusinessIdMEX();
                    break;

                default:
                    nationalId = "000000000";
                    break;
                }
            }
            else
            {
                nationalId = "*INVALID*";
            }
            return(nationalId);
        }