The UserId can be generated from a number using remainder and integer division as shown below:
void Main()
{
List<long> numbers = new List<long>{
999999, 1000000, 1999999,
1000000*26+1,
1000000*26*26-1};
foreach(long number in numbers)
Console.WriteLine (GetId(number));
}
public string GetId(long number){
long numberPart = number % 1000000;
int charPos = (int)number / 1000000;
return string.Format("{2}{1}{0}{3:000000}",
GetChar(ref charPos),GetChar(ref charPos),
GetChar(ref charPos),numberPart);
}
public char GetChar(ref int position){
int ind = position % 26;
position = position / 26;
return (char)(ind+65);
}
I have not checked exhaustively. So, check the above code for your requirement and make modifications as found necessary.