public TellerResult CreateAccount(string name, string password, string dob, string address, string phoneNumber) { if (!permissions.Contains(TellerPermissions.CreateAccount)) return TellerResult.NoPermissions; Account account = new Account(name, password, dob, address, phoneNumber); BankResult result = Bank.CreateNewAccount(this, account); if (result == BankResult.AccountCreated) return TellerResult.Success; else return TellerResult.NoSession; }
public Session(Teller teller, Account account) { this.teller = teller; this.account = account; }
public static BankResult WithdrawFunds(Account account, decimal amount) { return account.WithdrawFunds(amount, DateTime.Now); }
public static BankResult PayAccount(Account account, decimal amount) { // This is a very important command, so we add our own security. We send our current tick count, and the account will verify this was recent, and if it was, it will pay in. return account.PayInFunds(amount, DateTime.Now); }
/// <summary> /// Creates a new account without using a session /// </summary> /// <param name="teller">Teller</param> /// <param name="account">Account</param> /// <returns></returns> public static BankResult CreateNewAccount(Teller teller, Account account) { if (!tellers.ContainsKey(teller.ID)) return BankResult.TellerInvalid; if (accounts.ContainsValue(account)) return BankResult.AccountExists; account.Log(Encrypt("Account created by " + teller.Name + " (" + teller.ID + ")")); teller.Log(Encrypt("Created account for ID " + account.ID)); Log("Teller ID " + teller.ID + " created an account for account ID " + account.ID); accounts.Add(account.ID, account); return BankResult.AccountCreated; }
/// <summary> /// Creates a session between a teller and an account /// </summary> /// <param name="teller">Teller</param> /// <param name="account">Account</param> public static void CreateSession(Teller teller, Account account) { Session session = new Session(teller, account); sessions.Add(session); }
/// <summary> /// Create a session /// </summary> /// <param name="account">The account to create a session with</param> public void CreateSession(Account account) { Bank.CreateSession(this, account); }