// Lists accounts of particular client for current bank public void ListClientAccounts(Client client) { Console.WriteLine($"Accounts information for bank: {Name}"); BankClient bankClient = GetBankClientByClient(client); Console.WriteLine(bankClient.ToString()); if (AccountsIDs.ContainsKey(bankClient)) { foreach (Guid ID in AccountsIDs[bankClient]) { Console.WriteLine(IDsToAccount[ID].ToString()); } } }
// Creates account for client with given account type. public Guid CreateAccountForClient(Client client, AccountType type, DateTime date) { BankClient bankClient = GetBankClientByClient(client); // Check if bank client already exists in dictionary if (!AccountsIDs.ContainsKey(bankClient)) { AccountsIDs[bankClient] = new List <Guid>(); } Guid guid = CreateUnicID(); switch (type) { case AccountType.Debit: AccountsIDs[bankClient].Add(guid); IDsToAccount[guid] = new DebitAccount(bankClient, guid); Console.WriteLine($"{Name}: Created `Debit` Account for client with name {client.Name}"); break; case AccountType.Credit: AccountsIDs[bankClient].Add(guid); IDsToAccount[guid] = new CreditAccount(bankClient, guid); Console.WriteLine($"{Name}: Created `Credit` Account for client with name {client.Name}"); break; case AccountType.Saving: AccountsIDs[bankClient].Add(guid); IDsToAccount[guid] = new SavingAccount(bankClient, date, guid); Console.WriteLine($"{Name}: Created `Saving` Account client with name {client.Name}"); break; case AccountType.Business: AccountsIDs[bankClient].Add(guid); IDsToAccount[guid] = new BusinessAccount(bankClient, guid); Console.WriteLine($"{Name}: Created `Business` Account client with name {client.Name}"); break; } bankClient.AccountNumber++; // Return newly created accountID return(guid); }