public static bool vknValidation(string vkn)
{
long v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v6 = 0, v7 = 0, v8 = 0, v9 = 0,
v11 = 0, v22 = 0, v33 = 0, v44 = 0, v55 = 0, v66 = 0, v77 = 0, v88 = 0, v99 = 0,
lastDigit = 0, sum = 0;
if (vkn.Length == 10)
{
v1 = ((long)Char.GetNumericValue(vkn[0]) + 9) % 10;
v2 = ((long)Char.GetNumericValue(vkn[1]) + 8) % 10;
v3 = ((long)Char.GetNumericValue(vkn[2]) + 7) % 10;
v4 = ((long)Char.GetNumericValue(vkn[3]) + 6) % 10;
v5 = ((long)Char.GetNumericValue(vkn[4]) + 5) % 10;
v6 = ((long)Char.GetNumericValue(vkn[5]) + 4) % 10;
v7 = ((long)Char.GetNumericValue(vkn[6]) + 3) % 10;
v8 = ((long)Char.GetNumericValue(vkn[7]) + 2) % 10;
v9 = ((long)Char.GetNumericValue(vkn[8]) + 1) % 10;
lastDigit = (long)Char.GetNumericValue(vkn[9]);
v11 = (v1 * 512) % 9;
v22 = (v2 * 256) % 9;
v33 = (v3 * 128) % 9;
v44 = (v4 * 64) % 9;
v55 = (v5 * 32) % 9;
v66 = (v6 * 16) % 9;
v77 = (v7 * 8) % 9;
v88 = (v8 * 4) % 9;
v99 = (v9 * 2) % 9;
if (v1 != 0 && v11 == 0) { v11 = 9; }
if (v2 != 0 && v22 == 0) { v22 = 9; }
if (v3 != 0 && v33 == 0) { v33 = 9; }
if (v4 != 0 && v44 == 0) { v44 = 9; }
if (v5 != 0 && v55 == 0) { v55 = 9; }
if (v6 != 0 && v66 == 0) { v66 = 9; }
if (v7 != 0 && v77 == 0) { v77 = 9; }
if (v8 != 0 && v88 == 0) { v88 = 9; }
if (v9 != 0 && v99 == 0) { v99 = 9; }
sum = v11 + v22 + v33 + v44 + v55 + v66 + v77 + v88 + v99;
sum = (sum % 10 == 0) ? 0 : (10 - (sum % 10));
return (sum == lastDigit) ? true : false;
}
return false;
}