static void Main(string[] args) { BankManager bankManager = new BankManager(); bankManager.Run(); //AccountsManager manager = new AccountsManager(); //manager.CreateBillingAccount("Mg", "Mg", 1234567890); //manager.CreateSavingsAccount("Mg", "Mg", 1234567890); //manager.CreateSavingsAccount("aa", "aa", 0987654321); //IEnumerable<string> users = manager.ListOfCustomers(); //foreach (string customer in users) //{ // Console.WriteLine(customer); //} //IList<Account> accounts = (IList<Account>)manager.GetAllAccounts(); //Printer printer = new Printer(); //printer.Print(accounts[0]); //printer.Print(accounts[2]); Console.ReadKey(); }
public IncomingTransfer(BankManager bankManager, string fromAccountNumber, string toAccountNumber, double amount) { this.bankManager = bankManager; FromAccountNumber = fromAccountNumber; ToAccountNumber = toAccountNumber; Amount = amount; }
static void Main(string[] args) { //AccountsManager manager = new AccountsManager(); //manager.CreateBillingAccount("Marek", "Zajac", 92010133333); //manager.CreateSavingsAccount("Jacek", "Placek", 91010166666); //manager.CreateSavingsAccount("Zzzz", "Bbb", 0987654321); //manager.CreateSavingsAccount("Marek", "Jarecki", 1234554321); //IList<Account> accounts = (IList<Account>)manager.GetAllAccounts(); accounts = (IList<Account>)manager.GetAllAccounts(); //Printer printer = new Printer(); //foreach (Account account in accounts) //{ // printer.Print(account); //} //Console.ReadKey(); //IEnumerable<string> users = manager.ListOfCustomers(); //foreach (string user in users) //{ // Console.WriteLine(user); //} //Console.ReadKey(); //var konto = manager.GetAccount("940000000001"); //printer.Print(konto); //Console.ReadKey(); //manager.AddMoney("940000000001", 100); //printer.Print(konto); BankManager bankManager = new BankManager(); bankManager.Run(); }
public Transfer(BankManager bankManager, IAccount account, string accountNumber, double amount) { this.bankManager = bankManager; FromAccount = account; ToAccountNumber = accountNumber; Amount = amount; TransferType = Bank.TransferType.Charge; }
static void Main(string[] args) { string name = "Bank AKA"; string author = "Karol Aksamski"; Console.WriteLine(name); Console.WriteLine("Autor: " + author); Console.WriteLine(); Console.WriteLine("---"); Console.WriteLine(); BankManager bankManager = new BankManager(); bankManager.Run(); /* STARY PROGRAM * * //Stworzenie nowego managera kont * AccountsManager manager = new AccountsManager(); * * //Dodanie pierwszych kont użytkowników * manager.CreateSavingsAccount("Karol", "Aksamski", 95030112230); * manager.CreateSavingsAccount("Kamil", "Glinkowski", 92030212250); * manager.CreateBillingAccount("Karol", "Aksamski", 95030112230); * manager.CreateSavingsAccount("Kamil", "Podejrzany", 98472352230); * * //Zebranie listy wszystkich kont * IList<Account> accounts = (IList<Account>)manager.GetAllAccounts(); * * //Wypisanie ilości kont * Console.WriteLine("Liczba kont w systemie: {0}", accounts.Count); * Console.WriteLine(); * * //Deklaracja drukarki i wypisanie kont przykłądowych * IPrinter printer = new Printer(); * * foreach (Account account in accounts) * { * printer.Print(account); * } * * //Wypisanie kont w systemie w formacie: Imię | Nazwisko | PESEL * Console.WriteLine("Konta w systemie posiadają:"); * IEnumerable<string> users = manager.ListOfCustomers(); * * foreach(string user in users) * { * Console.WriteLine(user); * } * * //Oczekiwanie na ruch użytkownika * Console.ReadKey(); * */ }
static void Main(string[] args) { string name = "Nazwa: Bank"; string author = "Autor: Mariusz Wieczorek"; Console.WriteLine(name); Console.WriteLine(author); Console.WriteLine(); BankManager BankX = new BankManager(); BankX.Run(); }
public static void OperationsReportsTest() { BankManager bank = new BankManager("1000"); Owner owner1 = bank.CreateOwner("Jan", "Kowalski", "123456"); Console.WriteLine("Owner {0} {1} with PESEL {2} created.", owner1.FirstName, owner1.LastName, owner1.PESEL); string owner1AccountNum = owner1.OpenAccount(); Console.WriteLine("Account with number {0} created", owner1AccountNum); Owner owner2 = bank.CreateOwner("Anna", "Kowalska", "654321"); Console.WriteLine("\nOwner {0} {1} with PESEL {2} created.", owner2.FirstName, owner2.LastName, owner2.PESEL); string owner2AccountNum = owner2.OpenAccount(); Console.WriteLine("Account with number {0} created", owner2AccountNum); bank.CreatePayment(owner1AccountNum, 21000); Console.WriteLine("\nOwner1 payment, balance: {0}", bank.GetAccount(owner1AccountNum).Balance); bank.CreatePayout(owner1AccountNum, 100); Console.WriteLine("Owner1 payout, balance: {0}", bank.GetAccount(owner1AccountNum).Balance); bank.CreateTransfer(owner1AccountNum, owner2AccountNum, 20500); Console.WriteLine("Transfer: owner1's balance: {0}; owner2's balance: {1}", bank.GetAccount(owner1AccountNum).Balance, bank.GetAccount(owner2AccountNum).Balance); string owner1DebtAccountNum = owner1.OpenDebtAccount(200); Console.WriteLine("\nDebt account with number {0} and 200 debt created", owner1DebtAccountNum); bank.CreatePayment(owner1DebtAccountNum, 10); Console.WriteLine("Owner1 payment, balance: {0}", bank.GetAccount(owner1DebtAccountNum).Balance); bank.CreatePayout(owner1DebtAccountNum, 100); Console.WriteLine("Owner1 payout, balance: {0}, available debt: {1}", bank.GetAccount(owner1DebtAccountNum).Balance, ((DebtAccount)bank.GetAccount(owner1DebtAccountNum)).AvailableDebt); bank.CreatePayment(owner1DebtAccountNum, 100); Console.WriteLine("Owner1 payment, balance: {0}, available debt: {1}", bank.GetAccount(owner1DebtAccountNum).Balance, ((DebtAccount)bank.GetAccount(owner1DebtAccountNum)).AvailableDebt); Console.WriteLine("\nFull report:\n" + bank.CreateFullReport(owner1AccountNum)); Console.WriteLine("\nCharges report:\n" + bank.CreateChargesReport(owner1AccountNum)); Console.WriteLine("\nDeposits report:\n" + bank.CreateDepositsReport(owner1AccountNum)); }
//LogIn internal static void LogIn() { int i = 0; foreach (Bank bank in GetListOfBanks()) { Thread.Sleep(200); Console.WriteLine($"Bank {++i}: {bank.Location}"); } bool ok = false; Thread.Sleep(200); workingBank = BankManager.SelectBank(); do { Thread.Sleep(500); Console.Write("Username: "******"Password: "******"{user} {password}"; foreach (EmployeeUsers u in GetListOfUsers()) { if (user == u.Username && password == u.Password) { if (u.WorkLocation.ToUpperInvariant() == workingBank.Location.ToUpperInvariant()) { ok = true; } else { continue; } } } if (ok == false) { Console.WriteLine("\nWrong username or password. Try again!"); Thread.Sleep(800); //Console.Clear(); } } while (ok == false); }
public static void ElixirTest() { BankManager bank1 = new BankManager("1000"); BankManager bank2 = new BankManager("2000"); Elixir elixir = new Elixir(); elixir.Banks.Add(bank1.BankIdentifier, bank1); elixir.Banks.Add(bank2.BankIdentifier, bank2); Owner owner1 = bank1.CreateOwner("Jan", "Kowalski", "123456"); Console.WriteLine("Owner {0} {1} with PESEL {2} created.", owner1.FirstName, owner1.LastName, owner1.PESEL); string owner1AccountNum = owner1.OpenAccount(); Console.WriteLine("Account with number {0} created", owner1AccountNum); Owner owner2 = bank2.CreateOwner("Anna", "Kowalska", "654321"); Console.WriteLine("\nOwner {0} {1} with PESEL {2} created.", owner2.FirstName, owner2.LastName, owner2.PESEL); string owner2AccountNum = owner2.OpenAccount(); Console.WriteLine("Account with number {0} created", owner2AccountNum); bank1.CreatePayment(owner1AccountNum, 1000); Console.WriteLine("\nOwner1 payment, balance: {0}", bank1.GetAccount(owner1AccountNum).Balance); bank1.CreateTransfer(owner1AccountNum, owner2AccountNum, 500); bank1.CreateTransfer(owner1AccountNum, owner2AccountNum, 200); elixir.ExecuteTransfers(); Console.WriteLine("Transfer 500 + 200 from o1 to o2: owner1's balance: {0}; owner2's balance: {1}", bank1.GetAccount(owner1AccountNum).Balance, bank2.GetAccount(owner2AccountNum).Balance); bank1.CreateTransfer(owner1AccountNum, owner2AccountNum, 100); bank2.CreateTransfer(owner2AccountNum, owner1AccountNum, 200); elixir.ExecuteTransfers(); Console.WriteLine("Transfer 100 from o1 to o2, 200 from o2 to o1: owner1's balance: {0}; owner2's balance: {1}", bank1.GetAccount(owner1AccountNum).Balance, bank2.GetAccount(owner2AccountNum).Balance); }
static void Main(string[] args) { BankManager bankManager = new BankManager(); bankManager.Run(); }
static void Main(string[] args) { //AccountsManager manager = new AccountsManager(); // stworozny obiekt managera. Dzieki niemu mozna dodawac nowe konta w programie //manager.CreateBillingAccount("Marek", "Zajac", 1234567890); //manager.CreateSavingsAccount("Marek", "Zajac", 1234567890); //manager.CreateSavingsAccount("Aaaaa", "Bbbbb", 0987654321); //IEnumerable<Account> accounts = manager.GetAllAccounts(); //IEnumerable<string> users = manager.ListOfCustomers(); //foreach (string user in users) //{ // Console.WriteLine(user); //} BankManager bankManager = new BankManager(); bankManager.Run(); //wlaczajac aplikacje zobaczymy menu. //List<Account> accounts = new List<Account>(); //lista przechowujaca konta. Oba typy kont dziedzica po klasie Account //accounts.Add(new SavingsAccount(1, "940000000001", 0.0M, "Marek", "Zajac", 1234567890)); //accounts.Add(new SavingsAccount(2, "950000000001", 0.0M, "Tomasz", "Ostrowski", 123456789)); //accounts.Add(new SavingsAccount(3, "960000000001", 0.0M, "Zzzz", "Bbb", 0987654321)); //accounts.Add(new BillingAccount(4, "970000000001", 0.0M, "Marek", "Zajac", 1234567890)); //accounts.Add(new BillingAccount(5, "980000000001", 0.0M, "Marek", "Aaaa", 1234554321)); //SavingsAccount savingsAccount = new SavingsAccount(3, "940000000001", 0.0M, "Marek", "Zajac", 92010133333); //tworzy nowe konto, Definiujemy zmienną o nazwie savingsAccount, która jest typu SavingsAccount, co oznacza, że będzie mogła przechowywać obiekty tego typu. //SavingsAccount savingsAccount1 = new SavingsAccount(4, "950000000001", 0.0M, "Tomasz", "Ostrowski", 92032610377); //Tworzymy nowy obiekt klasy SavingsAccount.To jest nowość, o której za moment. //BillingAccount billingAccount = new BillingAccount(5, "960000000001", 0.0M, "Martyna", "Klis", 93030499881); //Przypisujemy utworzony obiekt do naszej zmiennej, a więc chowamy go od pudełka podpisanego jako savingsAccount. //account = new SavingsAccount(2, "940000000001", 0.0M, "Marek", "Zajac", 92010133333); //Console.WriteLine(account.TypeName()); //account = new BillingAccount(1,"960000000001", 0.0M, "Martyna", "Klis", 93030499881); //Console.WriteLine(account.TypeName()); //IList<int> lista = new List<int>(); //IEnumerable<int> lista2 = new List<int>(); //przypisanie listy do interfejsów //savingsAccount.Init("940000000001", 0.0M, "Marek", "Zajac", 92010133333); //pierwsze konto wypelnione danymi. Dostaje sie tam przez savingsAccount.Nazwa zmiennej // savingsAccount1.Init("950000000001", 0.0M, "Tomasz", "Ostrowski", 92032610377); //billingAccount.Init("960000000001", 0.0M, "Martyna", "Klis", 93030499881) //IPrinter printer = new Printer(); interfejs < //printer.Print(savingsAccount); //najpierw nazwa zmiennej w jakiej znajduje sie obiekt, potem kropke i na koncu nazwe funkcji //printer.Print(savingsAccount1); //printer.Print(billingAccount); Printer printer = new Printer(); //SmallerPrinter smallerPrinter = new SmallerPrinter(); //smallerPrinter.Print(billingAccount); //smallerPrinter.Print(savingsAccount); //string fullName = savingsAccount.GetFullName(); //odwolanie do savingsaccount.getfullname //string balance = savingsAccount.GetBalance(); //Console.WriteLine("Pierwsze konto w systemie dostał: {0}", fullName); //odowłanie do fullname //Console.WriteLine("Balans konta tej osoby to {0}", balance); //string fullName2 = billingAccount.GetFullName(); //string balance2 = billingAccount.GetBalance(); //Console.WriteLine("Drugie konto w systmie dostał: {0}", fullName2); //Console.WriteLine("Balans konta tej osoby to: {0}", balance); Console.ReadKey(); Console.ReadLine(); }