public static string GenerateUniqueClientID() { IndividualClientController clientController = new IndividualClientController(); BusinessClientController businessClientController = new BusinessClientController(); Random random = new Random(); List <Client> clients = new List <Client>(); clients.AddRange(clientController.Read()); clients.AddRange(businessClientController.Read()); Boolean done = false; string a = ""; while (!done) { int i = random.Next(0, 99999999); string chars = "ABCDE"; a = String.Format("{0}{1:00000000}", GetRandomCharacter(chars, random), i); done = true; foreach (Client c in clients) { if (a.Equals(c.ClientIdentifier)) { done = false; } } } return(a); }
void LoadIndividualClient() { //lstClientsI.Clear(); IndividualClientController individualClientController = new IndividualClientController(); lstClientsI.Items.Clear(); foreach (IndividualClient client in individualClientController.Read()) { ListViewItem lstI = new ListViewItem( new string[] { client.ClientIdentifier, client.Name, client.Surname, client.ContactNum } ); lstI.Tag = client; lstClientsI.Items.Add(lstI); } }
private FrmNewRequest(CallCentreLogic callCentreLogic) { InitializeComponent(); this.callCentreLogic = callCentreLogic; IndividualClientController individualClientController = new IndividualClientController(); BusinessClientController businessClientController = new BusinessClientController(); ServiceContractController serviceContractController = new ServiceContractController(); foreach (IndividualClient client in individualClientController.Read()) { cbExistingClient.Items.Add(client); } foreach (BusinessClient client in businessClientController.Read()) { cbExistingClient.Items.Add(client); } foreach (ServiceContract serviceContract in serviceContractController.Read()) { cbNewContractRequestServiceContract.Items.Add(serviceContract); } }