Ejemplo n.º 1
0
 public static Teller CreateTeller(string name, string password, List<TellerPermissions> permissions)
 {
     Teller teller = new Teller(tellers.Count, name, password, permissions);
     tellers.Add(teller.ID, teller);
     Log("Teller (" + teller.Name + ") with ID " + teller.ID + " created");
     return teller;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Searches the sessions to see if there is one between the two
 /// </summary>
 /// <param name="teller">The teller</param>
 /// <param name="account">The account</param>
 /// <returns>Returns the session if found. If not, returns null</returns>
 public static Session FindSession(Teller teller)
 {
     foreach (Session session in sessions)
     {
         if (session.Teller == teller)
             return session;
     }
     return null;
 }
Ejemplo n.º 3
0
 public Session(Teller teller, Account account)
 {
     this.teller = teller;
     this.account = account;
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 /// <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, int id)
 {
     CreateSession(teller, FindAccount(id));
 }
Ejemplo n.º 6
0
 /// <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);
 }