Esempio n. 1
0
        public int CheckDigitCalculate(AddChecksumEventArgs e)
        {
            int total = 0;
            bool flip = true;
            for (int i = e.Codes.Count-1; i > 0; i--)
            {
                if (flip)
                    total += e.Codes[i] * 3;
                else
                    total += e.Codes[i];

                flip = !flip;
            }

            total = total % 10;
            return total == 0 ? 0 : 10 - total;
        }
Esempio n. 2
0
        public int CheckDigitCalculate(AddChecksumEventArgs e)
        {
            int  total = 0;
            bool flip  = true;

            for (int i = e.Codes.Count - 1; i > 0; i--)
            {
                if (flip)
                {
                    total += e.Codes[i] * 3;
                }
                else
                {
                    total += e.Codes[i];
                }

                flip = !flip;
            }

            total = total % 10;
            return(total == 0 ? 0 : 10 - total);
        }