Esempio n. 1
0
        /// <summary>
        /// function to add new account to user.
        /// </summary>
        /// <param name="accountBuilder"></param>
        public void AddNewAccount(AccountBuilder accountBuilder)
        {
            IEntity newEntity = accountBuilder.Build();

            OperationGenerator.GenerateOperations(newEntity);
            this.userAccounts.Add(newEntity.GetEntityNumber(), newEntity);
        }
Esempio n. 2
0
        /// <summary>
        /// function to initialize checking account.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static User InitializeUserWithCheckingAccount(User user)
        {
            var            rand           = new Random();
            AccountBuilder accountBuilder = new AccountBuilder()
                                            .SetAccountNumber(rand.Next(1242434))
                                            .SetCurrentBalance(rand.NextDouble() * 400000)
                                            .SetType("CheckingAccount");

            user.AddNewAccount(accountBuilder);
            return(user);
        }
Esempio n. 3
0
        /// <summary>
        /// function to initialize savings account.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static User InitializeUserWithSavingsAccount(User user)
        {
            var            rand           = new Random();
            AccountBuilder accountBuilder = new AccountBuilder()
                                            .SetType("SavingsAccount")
                                            .SetAccountNumber(rand.Next(12334232))
                                            .SetInterestRate(rand.Next(15))
                                            .SetCurrentBalance(rand.NextDouble() * 30000);

            user.AddNewAccount(accountBuilder);
            return(user);
        }
Esempio n. 4
0
        /// <summary>
        /// function to initialize loan account.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static User InitializeUserWithLoanAccount(User user)
        {
            var            rand           = new Random();
            double         loanAmount     = rand.NextDouble() * 400000;
            AccountBuilder accountBuilder = new AccountBuilder()
                                            .SetType("LoanAccount")
                                            .SetAccountNumber(rand.Next(112324312))
                                            .SetTotalBalance(loanAmount)
                                            .SetInterestRate(rand.Next(15))
                                            .SetCurrentBalance(rand.NextDouble() * 30000);

            user.AddNewAccount(accountBuilder);
            return(user);
        }