Esempio n. 1
0
        public static Account.Account Create(AccountHolder accountHolder, string id, TypeOfBankScore typeOfBankScore, Status status = Status.Open)
        {
            Account.Account account = null;

            switch (typeOfBankScore)
            {
            case TypeOfBankScore.Base:
                accountHolder.AddAccount(id);
                account        = new BaseAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Silver:
                accountHolder.AddAccount(id);
                account        = new SilverAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Gold:
                accountHolder.AddAccount(id);
                account        = new GoldAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Platinum:
                accountHolder.AddAccount(id);
                account         = new PlatinumAccount(id, accountHolder);
                account.Status  = status;
                account.Balance = 20;
                return(account);

            default:
                throw new ArgumentException($"Invalid {nameof(typeOfBankScore)}");
            }
        }
Esempio n. 2
0
        public static Account Create(AccountType type, Person owner, string number, decimal sum, bool isClosed)
        {
            Account newAccount = null;

            switch (type)
            {
            case AccountType.Base:
                newAccount = new BaseAccount(owner, number, sum, isClosed);
                break;

            case AccountType.Gold:
                newAccount = new GoldAccount(owner, number, sum, isClosed);
                break;

            case AccountType.Platinum:
                newAccount = new PlatinumAccount(owner, number, sum, isClosed);
                break;
            }

            return(newAccount);
        }