public LoanAccount(Customer newCustomer, AccountData newAccount, double newBalance = 0.0) : base(newAccount) { if (newAccount != null) { // Set initial account balance. newAccount.ID = IAccountInfo.GetNewAccountNumber(); newAccount.AccountType = Utility.AccountType.LOAN; newAccount.LastTransactionState = Utility.TransactionCodes.SUCCESS; if (newBalance > 0.0) { newAccount.AccountBalance = newBalance; totalRecords.Add(new TransactionRecord(Utility.TransactionType.OPEN_ACCOUNT) { TransactionAmount = newBalance }); } else { newAccount.AccountBalance = 0.0; } // Set customer references. myCustomer = newCustomer; newAccount.CustomerID = newCustomer?.CustomerID ?? -1; myCustomer.AddAccount(this); } }
public CheckingAccount(Customer newCustomer, AccountData newAccount, double newBalance = 0.0) : base(newAccount) { if (newAccount != null) { // Set new account info. newAccount.ID = IAccountInfo.GetNewAccountNumber(); newAccount.AccountType = Utility.AccountType.CHECKING; // Set initial account balance. if (newBalance > 0.0) { newAccount.AccountBalance = newBalance; totalRecords.Add(new TransactionRecord(Utility.TransactionType.OPEN_ACCOUNT) { TransactionAmount = newBalance }); } else { newAccount.AccountBalance = 0.0; } // Set customer references. myCustomer = newCustomer; newAccount.CustomerID = newCustomer.CustomerID; myCustomer.AddAccount(this); } }
public TermDepositAccount(Customer newCustomer, AccountData newAccount, double newBalance = 0.0) : base(newAccount) { if (newAccount != null) { // Set initial account. newAccount.ID = IAccountInfo.GetNewAccountNumber(); newAccount.AccountType = Utility.AccountType.TERM; newAccount.LastTransactionState = Utility.TransactionCodes.SUCCESS; if (newBalance > 0.0) { newAccount.AccountBalance = newBalance; totalRecords.Add(new TransactionRecord(Utility.TransactionType.OPEN_ACCOUNT) { TransactionAmount = newBalance }); } else { newAccount.AccountBalance = 0.0; } // Set customer references. myCustomer = newCustomer; newAccount.CustomerID = newCustomer.CustomerID; // Default 1 Year term. newAccount.MaturityDate = DateTime.Now.AddYears(1); myCustomer.AddAccount(this); } }