private void GenerateAccountNumber(ListWindow wnd) { while (wnd.Dispatcher.Invoke(() => { return(wnd.IsLoaded); })) { } Random rand = new Random(); var randomDigit = rand.Next(0, 9).ToString(); var code = "3014"; var clientPart = GetCorrectClientPart(_accountModel.ClientId); using (ClientsEntities db = new ClientsEntities()) { var accountCountPart = db.GetUserAccountsCountById(_accountModel.ClientId) + 1; _accountModel.AccountNumber = code + clientPart + GetCorrectAccountCountPart(accountCountPart) + randomDigit; } }
private void ListButton_Click(object sender, RoutedEventArgs e) { ListWindow listWindow = new ListWindow(Client); listWindow.Show(); }