示例#1
0
        //public Exception AccountTypeNotFoundException { get; private set; }

        public Account OpenAccount(string accountType)
        {
            if (accountType == null)
            {
                return(null);
            }

            Account account = null;

            switch (accountType.ToLower())
            {
            case "base":
                account = new BaseAccount();
                break;

            case "gold":
                account = new GoldAccount();
                break;

            case "premium":
                account = new PremiumAccount();
                break;

            default:
                throw new NotImplementedException();
            }

            return(account);
        }
        public BankAccount CreateBankAccount(string accountType)
        {
            BankAccount bankAccount = null;

            if (accountType.Equals(BaseAccount.GRADATION))
            {
                bankAccount = new BaseAccount();
            }

            if (accountType.Equals(GoldAccount.GRADATION))
            {
                bankAccount = new GoldAccount();
            }

            if (accountType.Equals(PlatinumAccount.GRADATION))
            {
                bankAccount = new PlatinumAccount();
            }

            return(bankAccount);
        }
        public Account Create(string numberAcc, string firstName, string secondName, string email, decimal balance = 0)
        {
            BaseAccount acc = new BaseAccount(numberAcc, firstName, secondName, email, balance);

            return(acc);
        }