public static void TermMature(string TermaccId, decimal ammount) { AccountStore.addAccountid('c'); string AccId = AccountStore.lastmadeAccId; Checking newChecking = new Checking(AccId); AccountStore.addAccount(AccId, newChecking); AccountBalance.setBalance(AccId, ammount); AccountBalance.setBalance(TermaccId, 0); TransactionStore.AddTransferTransaction(AccId, null, 0, 0, ammount); TransactionStore.AddTransferTransaction(TermaccId, null, 3, 5, ammount); AccCreator.AccountCloser(TermaccId); }
public static void MenuRedirect(int input) { switch (input) { case 0: AccCreator.Greeting(); AccCreator.ParseInput(); AccCreator.Creator(AccCreator.parsedInput); break; case 1: AccCreator.AccountCloser(); break; case 2: BalanceTransact.SelectAcc('w'); break; case 3: BalanceTransact.SelectAcc('d'); break; case 4: BalanceTransact.SelectAcc('t'); break; case 5: BalanceTransact.Pay(); break; case 6: AccViewer.getAccounts(); break; case 7: TransactionViewer.Display(); break; case 8: TimeSim.PassTime(); break; } }
public static void Pay() { int existCheck = 0; Dictionary <string, object> canPay = new Dictionary <string, object>(); foreach (KeyValuePair <string, Account> entry in AccountStore.StoredAccounts) { if (entry.Value.AccountId[0] == 'l' || entry.Value.AccountId[0] == 'o') { canPay.Add(entry.Key, entry.Value); } } if (canPay.Count == 0) { Console.WriteLine("You have no accounts to pay"); } else { Console.WriteLine("Which account would you like to pay?"); while (true) { Console.WriteLine("|{0,-15}|{1,-20}|", "AccountId", "Balance"); Console.WriteLine("|" + new string('-', 15) + '|' + new string('-', 20) + "|"); foreach (KeyValuePair <string, object> entry in canPay) { Console.WriteLine("|{0,-15}|{1,-20}|", entry.Key, AccountBalance.Balance[entry.Key]); } string accId = Console.ReadLine(); if (canPay.ContainsKey(accId)) { Console.WriteLine("How much would you like to pay?"); input = Console.ReadLine(); parsed = decimal.TryParse(input, out _checkedInput); if (parsed && _checkedInput >= 0) { bool didClose; bool exit; decimal output; _checkedInput = Math.Round(_checkedInput, 2); Payment(accId, _checkedInput, out output, out didClose); if (didClose == true) { if (!(AccountStore.StoredAccounts[accId]._AssociatedAccountId is null)) { AccountStore.StoredAccounts[AccountStore.StoredAccounts[accId]._AssociatedAccountId]._AssociatedAccountId = null; } AccCreator.AccountCloser(accId); break; } Console.WriteLine("Your new balance is: $" + AccountBalance.Balance[accId] + "\nWould you like to pay more? (y/n)"); Parsers.YNCheck(); exit = Parsers.YNtoBool[Parsers.parsedYN]; if (!exit == true) { break; } } else { Parsers.InvalidInput(); } } else { Parsers.InvalidInput(); } } } }