Exemplo n.º 1
0
        public static Account CreateAccount(string accountName, string emailAddress, TypeOfAccount accountType = TypeOfAccount.Checking, decimal initialDeposit = 0)
        {
            if (string.IsNullOrEmpty(accountName))
            {
                throw new ArgumentNullException("accountName", "Account name is required!");
            }

            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress", "An Email Address is required!");
            }

            var account = new Account
            {
                AccountName  = accountName,
                EmailAddress = emailAddress,
                AccountType  = accountType
            };

            if (initialDeposit > 0)
            {
                account.Deposit(initialDeposit);
            }

            db.Accounts.Add(account);
            db.SaveChanges();
            return(account);
        }
 public CurrentAccount()
 {
     this.AccountType     = TypeOfAccount.Current;
     this.AccountOwner    = new Client();
     this.AccountCurrency = Currency.PLN;
     this.DateOfCreate    = DateTime.Now;
     this.AccountID       = 0;
 }
Exemplo n.º 3
0
 public Account(string name, double balance, double credit, TypeOfAccount typeOfAccount)
 {
     this.Name          = name;
     this.Balance       = balance;
     this.Credit        = credit;
     this.TypeOfAccount = typeOfAccount;
     Console.WriteLine("É um prazer ter você conosco, {0}!", this.Name);
 }
 public CurrentAccount(int accountBalance, Client accountOwner, int accountId)
 {
     this.DateOfCreate    = DateTime.Now;
     this.AccountCurrency = Currency.PLN;
     this.AccountBalance  = accountBalance;
     this.AccountOwner    = accountOwner;
     this.AccountID       = accountId;
     this.AccountType     = TypeOfAccount.Current;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Create an account with the Bank
        /// </summary>
        /// <param name="emailAddress">email of the account</param>
        /// <param name="accountType">Type of account</param>
        /// <param name="initialAmount">Initial deposit</param>
        /// <returns>Newly Created Account</returns>
        public static Account CreateAccount(string emailAddress, TypeOfAccount accountType = TypeOfAccount.Checking, decimal initialAmount = 0)
        {
            var account = new Account
            {
                EmailAddress = emailAddress,
                AccountType  = accountType,
            };

            if (initialAmount > 0)
            {
                account.Deposit(initialAmount);
            }
            return(account);
        }
Exemplo n.º 6
0
        public static Account CreateAccount(string emailAddress,
                                            string accountName        = "Default Account",
                                            TypeOfAccount accountType = TypeOfAccount.Checking)
        {
            Account account = new Account
            {
                EmailAddress = emailAddress,
                AccountName  = accountName,
                AccountType  = accountType,
            };

            db.Accounts.Add(account);
            db.SaveChanges();
            return(account);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Bank creates an account for the user
        /// </summary>
        /// <param name="emailAddress">Email address of the account</param>
        /// <param name="accountType">Type of Account</param>
        /// <param name="initialDeposit">Initial amount to deposit</param>
        /// <returns>Returns the new account</returns>
        public static Account CreateAccount(string emailAddress, TypeOfAccount accountType = TypeOfAccount.Checking, decimal initialDeposit = 0)
        {
            var account = new Account
            {
                EmailAddress = emailAddress,
                AccountType  = accountType
            };

            if (initialDeposit > 0)
            {
                account.Deposit(initialDeposit);
            }
            db.Accounts.Add(account);
            db.SaveChanges();
            return(account);
        }
Exemplo n.º 8
0
        public Account CreateAccount(string accountName, string emailAddress, TypeOfAccount accountType, decimal initialDeposit)
        {
            var account = new Account
            {
                AccountName  = accountName,
                EmailAddress = emailAddress,
                AccountType  = accountType
            };

            if (initialDeposit > 0)
            {
                account.Deposit(initialDeposit);
            }

            return(account);
        }
Exemplo n.º 9
0
        public static Account CreateAccount(string accountName, string emailAddress, TypeOfAccount accountType = TypeOfAccount.Checking, decimal initialDeposit = 0)
        {
            var account = new Account
            {
                AccountName  = accountName,
                EmailAddress = emailAddress,
                AccountType  = accountType
            };

            if (initialDeposit > 0)
            {
                account.Deposit(initialDeposit);
            }

            accounts.Add(account);
            return(account);
        }
Exemplo n.º 10
0
 public Account(int numeroDaConta, int digitoDaConta, SpecieOfAccount especieDaConta,
                TypeOfAccount tipoDaConta, ProfileOfAccount perfilDaConta, StatusOfAccount statusDaConta,
                string nomeDoTitular, string sobreNomeDoTitular, double valorChequeEspecial,
                double valorEmConta, double saldoDaConta)
 {
     this.NumeroDaConta       = numeroDaConta;
     this.DigitoDaConta       = digitoDaConta;
     this.EspecieDaConta      = especieDaConta;
     this.TipoDaConta         = tipoDaConta;
     this.PerfilDaConta       = perfilDaConta;
     this.StatusDaConta       = statusDaConta;
     this.NomeDoTitular       = nomeDoTitular;
     this.SobreNomeDoTitular  = sobreNomeDoTitular;
     this.ValorEmConta        = valorEmConta;
     this.ValorChequeEspecial = valorChequeEspecial;
     this.SaldoDaConta        = saldoDaConta;
 }
Exemplo n.º 11
0
        // private static List<Account> accounts = new List<Account>();
        /// <summary>
        /// Create a bank account
        /// </summary>
        /// <param name="emailAddress">Email address for acc</param>
        /// <param name="accountName">Name of the account</param>
        /// <param name="accountType">Type of account</param>
        /// <returns>Returns bank account</returns>
        /// <exception cref="ArgumentNullException"/>
        public static Account CreateAccount(String emailAddress, string accountName = "Default Name",
                                            TypeOfAccount accountType = TypeOfAccount.Checkings)
        {
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress", "Email address cannot be empty.");
            }
            var account = new Account
            {
                EmailAddress = emailAddress,
                AccountName  = accountName,
                AccountType  = accountType
            };

            db.Accounts.Add(account);
            db.SaveChanges();
            return(account);
        }
Exemplo n.º 12
0
        public static Account CreateAccount(String emailAddress, TypeOfAccount accountType, decimal amount = 0)
        {
            var account = new Account
            {
                EmailAddress = emailAddress,
                AccountType  = accountType,
            };

            if (amount > 0)
            {
                account.Deposit(amount);
            }
            // AllAccounts.Add(account);
            db.Accounts.Add(account);
            db.SaveChanges();

            return(account);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Create an account with the bank
        /// </summary>
        /// <param name="emailAddress">Email Adress of the account</param>
        /// <param name="accountType">Type of Account</param>
        /// <param name="initialAmount">Initial deposit</param>
        /// <returns>Newly created account</returns>
        /// <exception cref="ArgumentNullException" />

        public static Account CreateAccount(string emailAddress, TypeOfAccount accountType = TypeOfAccount.Checking, decimal initialAmount = 0)
        {
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException(nameof(emailAddress), "Email address is required!");
            }
            var account = new Account
            {
                EmailAddress = emailAddress,
                AccountType  = accountType
            };

            if (initialAmount > 0)
            {
                account.Deposit(initialAmount);
            }
            db.Accounts.Add(account);
            db.SaveChanges();
            return(account);
        }
Exemplo n.º 14
0
        public static UserAccount CreateUser(string userEmailId, string userName = "******", TypeOfAccount accountType = TypeOfAccount.user)
        {
            var useraccount = new UserAccount
            {
                UserEmailId = userEmailId,
                UserName    = userName,
                AccountType = accountType
            };

            db.UserAccounts.Add(useraccount);
            db.SaveChanges();
            return(useraccount);
        }
Exemplo n.º 15
0
        public static Account CreateAccount(string emailAddress, string accountName = "Default Account", TypeOfAccount accountType = TypeOfAccount.Checkings)
        {
            var account = new Account()
            {
                EmailAddress = emailAddress,
                AccountName  = accountName,
                AccountType  = accountType
            };

            accounts.Add(account);
            return(account);
        }