/// <summary>
 /// Checks if balance is more than the upper limit and sets the right state.
 /// </summary>
 public override void StateChangeCheck(BankAccount bankAccount)
 {
     //Checks if balance is more than the upper limit to change the state to the next one
     if (bankAccount.Balance > UpperLimit)
     {
         bankAccount.AccountStateId = SilverState.GetInstance().AccountStateId;
     }
 }
Exemple #2
0
 /// <summary>
 /// Checks if the balance is greater than the upper limit - If so, change the state to silver
 /// </summary>
 /// <param name="bankAccount">Evaluates bankAccount.balance</param>
 public override void StateChangeCheck(BankAccount bankAccount)
 {
     if (!bankAccount.Description.Equals("Mortgage")) //Check to see if the bank account is not a Mortgage account
     {
         if (bankAccount.Balance > UPPER_LIMIT)
         {
             //Set bankAccount's AccountStateId equal to the GoldState's AccountStateId field
             //if the balance is greater than the UPPER_LIMIT of this instance
             bankAccount.AccountStateId = SilverState.GetInstance().AccountStateId;
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Checks if the balance is greater than the upper limit - If so, change the state to Platinum
 /// Checks if the balance is less than the lower limit - If so, change the state to Silver
 /// </summary>
 /// <param name="bankAccount">Evaluates the bankAccount.Balance</param>
 public override void StateChangeCheck(BankAccount bankAccount)
 {
     if (!bankAccount.Description.Equals("Mortgage"))
     {
         if (bankAccount.Balance > UPPER_LIMIT)
         {
             bankAccount.AccountStateId = PlatinumState.GetInstance().AccountStateId;
         }
         else if (bankAccount.Balance < LOWER_LIMIT)
         {
             bankAccount.AccountStateId = SilverState.GetInstance().AccountStateId;
         }
     }
 }
        /// <summary>
        /// Setting the current state to the right one
        /// </summary>
        /// <param name="bankAccount"></param>
        public override void StateChangeCheck(BankAccount bankAccount)
        {
            //Checks if balance is less than lower limit
            if (bankAccount.Balance < this.LowerLimit)
            {
                bankAccount.AccountStateId = SilverState.GetInstance().AccountStateId;
            }

            //Checks if balance is more than upper limit
            if (bankAccount.Balance > this.UpperLimit)
            {
                bankAccount.AccountStateId = PlatinumState.GetInstance().AccountStateId;
            }
        }