static void Main(string[] args) { // hardcode (i just didnt want to think about db or any files with data =) ) Account acc1 = Account.CreateAccount(100, "uah"); // id 1 Account acc2 = Account.CreateAccount(5454, "uah"); // 2 Account acc3 = Account.CreateAccount(200, "usd"); // . Account acc4 = Account.CreateAccount(123, "uah"); // . Account acc5 = Account.CreateAccount(1, "usd"); Account acc6 = new Account(); // this acc is not added to bank system initially Account acc7 = new Account(); // so we add explisitly BankSystem.AddAccounts(new Account[] { acc6, acc7 }); // head od hierarchy // basic user with no power User basicUser = new User(1, "Andrii", "Koval", "login", "password"); //bank client is able to have bank accounts Console.WriteLine("---------------------Creatinh Bank Client"); BankClient client = BankClient.CreateBankClient(); Console.WriteLine("---------------------Creatinh Bank Client"); // a piece of hardcode ((( client.AddAccountId(acc1.id); client.AddAccountId(acc3.id); client.AddAccountId(acc5.id); client.ShowInfo(); Console.WriteLine("---------------------Creatinh Bank Exmployee"); BankEmployee employee = BankEmployee.CreateBankEmployee(); Console.WriteLine("---------------------Creating Bank Exmployee"); BankSystem.AddUser(employee); BankSystem.AddUser(client); BankSystem.AddUser(basicUser); Console.WriteLine("\n------------------------------------All users in system"); foreach (var user in BankSystem.Users.Values) { user.ShowInfo(); } Console.WriteLine("------------------------------------All users in system\n"); acc1.IncreaseAmount(100); acc3.IncreaseAmount(100); acc5.DecreaseAmount(50000); client.ShowInfo("CLIENT OVERRIDEN METHOD", "CLIENT OVERRIDEN METHOD"); Console.WriteLine(employee.systemUsersCount); }
private static void MainDemo() { var acc1 = new Account(100, "uah"); // id 1 var acc2 = new Account(5454, "uah"); // 2 var acc3 = new Account(200, "usd"); // . var acc4 = new Account(1, "usd"); try { acc1.Activate("Bank228"); acc2.Activate("Bank228"); acc3.Activate("Bank228"); acc4.Activate("WorngPass"); } catch { } Console.WriteLine("---------------------Creating Bank Client"); BankClient client = BankClient.CreateBankClient(); BankClient client2 = BankClient.CreateBankClient(); Console.WriteLine("---------------------Creating Bank Client"); client.AddAccountId(acc1.id); client.AddAccountId(acc3.id); client.ShowInfo(); Console.WriteLine("---------------------Creating Bank Exmployee"); var employee = BankEmployee.CreateBankEmployee(); Console.WriteLine("---------------------Creating Bank Exmployee"); User basicUser = new User("Andrii", "Koval", "login", "password"); BankSystem.AddUser(employee); BankSystem.AddUser(client); BankSystem.AddUser(client2); BankSystem.AddUser(basicUser); }
static void Main(string[] args) { var acc1 = new Account(100, "uah"); // id 1 var acc2 = new Account(5454, "uah"); // 2 var acc3 = new Account(200, "usd"); // . var acc4 = new Account(1, "usd"); acc1.Activate("Bank228"); acc2.Activate("Bank228"); acc3.Activate("Bank228"); acc4.Activate("WorngPass"); Console.WriteLine("---------------------Creating Bank Client"); BankClient client = BankClient.CreateBankClient(); BankClient client2 = BankClient.CreateBankClient(); Console.WriteLine("---------------------Creating Bank Client"); client.AddAccountId(acc1.id); client.AddAccountId(acc3.id); client.ShowInfo(); Console.WriteLine("---------------------Creating Bank Exmployee"); var employee = BankEmployee.CreateBankEmployee(); Console.WriteLine("---------------------Creating Bank Exmployee"); User basicUser = new User("Andrii", "Koval", "login", "password"); BankSystem.AddUser(employee); BankSystem.AddUser(client); //1 BankSystem.AddUser(client2); //2 BankSystem.AddUser(basicUser); User user2 = new User("Bodia", "bogdan", "log", "pass"); User user3 = new User("3", "3", "3", "3"); User[] IComparableDemoArray = new User[] { basicUser, user3, user2 }; Array.Sort(IComparableDemoArray); Console.WriteLine("Sorting demo"); foreach (User user in IComparableDemoArray) { user.ShowInfo(); } Console.WriteLine("Sorting demo"); // var foundUser = BankSystem.Users["a"]; // if (foundUser != null) // Console.WriteLine(foundUser.FullName); //extension Console.WriteLine(BankSystem.Users.GetBankClientsCount()); SerializationDemoXML(); SerializationDemoJSON(); var obj = new CustomGeneric <BankEmployee>(employee); obj.getAllPossibilities(); }
static void Main(string[] args) { var acc1 = new Account(100, "uah"); // id 1 var acc2 = new Account(5454, "uah"); // 2 var acc3 = new Account(200, "usd"); // . var acc4 = new Account(1, "usd"); acc1.Activate("Bank228"); acc2.Activate("Bank228"); acc3.Activate("Bank228"); acc4.Activate("WorngPass"); // head od hierarchy // basic user with no power User basicUser = new User("Andrii", "Koval", "login", "password"); //bank client is able to have bank accounts Console.WriteLine("---------------------Creating Bank Client"); BankClient client = BankClient.CreateBankClient(); Console.WriteLine("---------------------Creating Bank Client"); // a piece of hardcode ((( client.AddAccountId(acc1.id); client.AddAccountId(acc3.id); client.ShowInfo(); Console.WriteLine("---------------------Creating Bank Exmployee"); var employee = BankEmployee.CreateBankEmployee(); Console.WriteLine("---------------------Creating Bank Exmployee"); BankSystem.AddUser(employee); BankSystem.AddUser(client); BankSystem.AddUser(basicUser); employee.ShowPossibleSystemActions(); client.ShowPossibleSystemActions(); Console.WriteLine("\n------------------------------------All users in system"); foreach (var user in BankSystem.Users.Values) { user.ShowInfo(); } Console.WriteLine("------------------------------------All users in system\n"); acc1.IncreaseAmount(100); acc3.IncreaseAmount(100); acc4.DecreaseAmount(550000); client.ShowInfo("CLIENT OVERRIDEN METHOD", "CLIENT OVERRIDEN METHOD"); try { Console.WriteLine(employee.SystemUsersCount); } catch (EmployeeAccessException exp) { Console.WriteLine("Error"); Console.WriteLine(exp.args.Message); } try { employee.TakeCredit(45); } catch (EmployeeAccessException exp) { Console.WriteLine(exp.Message); } try { employee.ExchangeMoney(45, 5, 545); } catch (EmployeeAccessException exp) { Console.WriteLine(exp.Message); } }