コード例 #1
0
        public Account OpenAccount(string owner, AccountType accountType, IAccountNumberCreateService creator)
        {
            Account account;

            string[] fullName = owner.Split();
            switch (accountType)
            {
            case AccountType.Base:
                account = new BaseAccount(creator.GenerateId(), fullName[0], fullName[1]);
                break;

            case AccountType.Silver:
                account = new SilverAccount(creator.GenerateId(), fullName[0], fullName[1]);
                break;

            case AccountType.Gold:
                account = new GoldAccount(creator.GenerateId(), fullName[0], fullName[1]);
                break;

            case AccountType.Platinum:
                account = new PlatinumAccount(creator.GenerateId(), fullName[0], fullName[1]);
                break;

            default:
                account = new BaseAccount(creator.GenerateId(), fullName[0], fullName[1]);
                break;
            }

            this.repository.AddAccount(account.ToDalAccount());
            return(account);
        }
コード例 #2
0
        /// <summary>
        /// Create new account
        /// </summary>
        /// <param name="account"></param>
        public void OpenAccount(string owner, CardType type, IAccountNumberCreateService id)
        {
            Account acc = new Account(id.GenerateId(GetNumberOfAccounts() + 1), owner, type);

            repo.Create(AccountMapper.Mapper.Map <AccountDTO>(acc));
        }