Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the PlatinumAccount class.
 /// </summary>
 /// <param name="accOwner"></param>
 /// <returns>instance</returns>
 public PlatinumAccount(AccountOwner accOwner, IidGenerator idGenerator, IPointsCounter counter) : base(accOwner, idGenerator, counter)
 {
 }
Esempio n. 2
0
        /// <summary>
        /// Creates new account of the given type and adds it to the storage
        /// </summary>
        /// <param name="accType"></param>
        /// <param name="owner"></param>
        /// <returns>account's id</returns>
        public string CreateNewAccount(AccountTypes accType, AccountOwner owner, IidGenerator generator, IPointsCounter counter)
        {
            if (owner == null)
            {
                throw new ArgumentNullException();
            }

            Account newAcc;

            switch (accType)
            {
            case AccountTypes.Basic:
                currStorage.Add(newAcc = new BaseAccount(owner, generator, counter));
                break;

            case AccountTypes.Golden:
                currStorage.Add(newAcc = new GoldenAccount(owner, generator, counter));
                break;

            case AccountTypes.Platinum:
                currStorage.Add(newAcc = new PlatinumAccount(owner, generator, counter));
                break;

            default:
                throw new Exception("Can't create an account");
            }

            return(newAcc.Accid);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes basis for a new instance of the Account class.
 /// </summary>
 /// <param name="accOwner"></param>
 /// <returns>instance</returns>
 protected Account(AccountOwner accOwner, IidGenerator idGenerator, IPointsCounter counter)
 {
     Owner         = accOwner;
     accId         = idGenerator.Generate();
     pointsCounter = counter;
 }
 /// <summary>
 /// Initializes a new instance of the GoldenAccount class.
 /// </summary>
 /// <param name="accOwner"></param>
 /// <returns>instance</returns>
 public GoldenAccount(AccountOwner accOwner, IidGenerator idGenerator, IPointsCounter counter) : base(accOwner, idGenerator, counter)
 {
 }