Esempio n. 1
0
        static void Main(String[] args)
        {
            var _bank          = new Bank("Tinkoff Bank");
            var _client        = Client.Builder("Fredi", "Kats").SetAddress("Лесной пр-кт, д. 9").SetPassport("1234567890").GetClient();
            var _creditAccount = new CreditAccount(_client, 2000, 4000, 2);

            _bank.AddClient(_client);
            _bank.AddAccountToClient(_client, _creditAccount);

            _bank.Withdraw(_creditAccount.Id, 3000);
            Console.WriteLine(_creditAccount.Balance);
        }
Esempio n. 2
0
File: Bank.cs Progetto: dd-gif/OOP
 public void CreateCredit(int cid)
 {
     try
     {
         if (!_clients.ContainsKey(cid))
         {
             throw new AccountException($"id {cid}: there isn't client with such id");
         }
         var tmp = new CreditAccount(_clients[cid], 0, this, _limit, _commission);
         _accounts.Add(cid, new Dictionary <int, Account>());
         _accounts[cid].Add(_accountId, tmp);
         _accountId++;
     }
     catch (AccountException e)
     {
         Console.WriteLine($"{e.Message}");
     }
 }