Adf.Business.ValueObject.Sofinummer.ElfProefSofi C# (CSharp) Method

ElfProefSofi() private static method

Indicates whether the supplied value is a valid Sofinummer or not.
private static ElfProefSofi ( string sofiNr ) : bool
sofiNr string The supplied value.
return bool
        private static bool ElfProefSofi(string sofiNr)
        {
            bool result = false;
            long som = 0;
            string cleanSofiNr = sofiNr.Replace(".", "");

            // Een Sofinummer bestaat uit 9 cijfers
            if ((cleanSofiNr.Length == 9))
            {
                for (int i = 1; (i <= 9); i++)
                {
                    int cijfer = int.Parse(cleanSofiNr.Substring((i - 1), 1), CultureInfo.CurrentCulture);
                    if (i == 9)
                    {
                        som += (cijfer*-(i + 1));
                    }
                    else
                    {
                        som += (cijfer*(i + 1));
                    }
                }
                // De som van de vermenigvuldigingen moet deelbaar zijn door 11
                result = (((som%11) == 0));
            }
            return result;
        }