Example #1
0
        private Boolean CheckAFM()
        {
            Int32 sum        = 0;
            Int32 pointer    = 1;
            Int64 dummyInt64 = 0;

            if (Int64.TryParse(AFM, out dummyInt64) && AFM.Length == 9)
            {
                if (dummyInt64 != 0)
                {
                    while (pointer < 9)
                    {
                        sum += Int32.Parse(AFM.Substring(pointer - 1, 1)) * Convert.ToInt32(Math.Pow(2, (9 - pointer)));
                        pointer++;
                    }
                    sum = sum % 11;
                    if (sum == 10)
                    {
                        sum = 0;
                    }
                    if (Int32.Parse(AFM.Substring(8, 1)) == sum)
                    {
                        pointer = 1;
                    }
                    else
                    {
                        pointer = 0;
                    }
                }
            }
            else
            {
                pointer = 0;
            }

            if (pointer != 1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #2
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     AFM.Focus();
 }