Hi I am writing some logic that take first name from text file and Generate Employee ID for that Employee format First name Jack the id will be jak, put if I have to user with the same Employee with the same name or same user the Id format will be like this jak01
Code Csharp:List<string> empIDList = new List<string>(); for (int i = 0; i < emp.Length; i++) { for (int j = i + 1; j < emp.Length; j++) { if (emp[i].FirstName != emp[j].FirstName) { empIDList.Add(emp[i].FirstName.Substring(0, 3)); break; } else if (emp[i].FirstName == emp[j].FirstName) { numSufix++; empIDList.Add(emp[i].FirstName.Substring(0, 3) + numSufix.ToString()); break; } } }



Reply With Quote

Bookmarks