protected Account(Customer accCust, decimal interest, DateTime date, decimal saldo) { this.Customer = accCust; this.Interest = interest; this.Balance = saldo; this.OpenDate = date; }
static void testDatabase() { Database d = new Database(); List<Customer> list = new List<Customer>(); Customer c = new Customer("Test","Console App",0,0,0); list.Add(c); d.save(list); Console.WriteLine("Testing Database.cs.....\n"); Console.WriteLine("Customer's name: " + c.name+"\nNumbers of customers in the list: "+list.Count); }
// Constructors public BankAccount(AccountType type, AccountCurrency currency, AccountPeriod period, Customer owner, long accountNumber) { this.Type = type; this.Currency = currency; this.Period = period; this.Owner = owner; this.CurrentBalance = 0; this.accountNumber = accountNumber; this.CalculateInterestRate(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Database db = new Database(); Customer c1 = new Customer("D, Trump", "Atlantic City,NJ", 000, 100, 80); new Thread(A).Start(db); //A thread for ATM new Thread(A).Start(db); //A thread for ATM Thread t = new Thread(T); // A thread for teller. t.SetApartmentState(ApartmentState.STA); t.Start(db); }
// Constructors public LoanAccount(AccountType type, AccountCurrency currency, AccountPeriod period, decimal loanAmount, Customer owner, long accountNumber) : base(type, currency, period, owner, accountNumber) { if (loanAmount > 0) { this.loanAmount = loanAmount; } else { throw new ArgumentException("Amount of the loan must be bigger than 0"); } }
// Constructors public MortgageAccount(AccountType type, AccountCurrency currency, AccountPeriod period, RealEstate ownerProperty, decimal loanAmount, Customer owner, long accountNumber) : base(type, currency, period, owner, accountNumber) { this.ownerProperty = ownerProperty; if (loanAmount > 0) { if (this.ownerProperty.Price >= loanAmount) { this.loanAmount = loanAmount; } else { throw new ArgumentException(String.Format("Loan amount cannot exceed: {0}", this.ownerProperty.Price)); } } else { throw new ArgumentException("Amount of the loan must be bigger than 0"); } }
public void TestAddAccount_AddOneAccount_OneAccountInListAndTrue() { #region Arrange Customer customer = new Customer("Sven Svensson"); Account account = new Account("Savings", 250, false); List<Account> accountList = new List<Account>(); #endregion #region Act accountList = customer.GetAllAccounts(); bool result = customer.AddAccount(account); bool expected = true; int resultTwo = accountList.Count; int expectedTwo = 1; #endregion #region Assert Assert.AreEqual(expected, result); Assert.AreEqual(expectedTwo, resultTwo); #endregion }
public void TestAddAccount_AddTwoAccountsWithUniqueNames_TwoAccountsInListAndTrue() { #region Arrange Customer customer = new Customer("Sven Svensson"); Account account = new Account("Savings", 6500, false); Account accountTwo = new Account("Poker winnings", 3100, false); #endregion #region Act bool result = customer.AddAccount(account); bool expected = true; bool resultTwo = customer.AddAccount(accountTwo); bool expectedTwo = true; int resultThree = customer.GetAllAccounts().Count; int expectedThree = 2; #endregion #region Assert Assert.AreEqual(expected, result); Assert.AreEqual(expectedTwo, resultTwo); Assert.AreEqual(expectedThree, resultThree); #endregion }
public void TestGetSpecificAccount_GetSpecificAccountWhenNameMatches_SpecificAccountWithMatchingName() { #region Arrange Customer customer = new Customer("Per Persson"); Account account = new Account("Poker winnings", 6500, false); customer.AddAccount(account); #endregion #region Act Account matchingAccount = customer.GetSpecificAccount("Poker winnings"); string result = matchingAccount.GetAccountName(); string expected = "Poker winnings"; #endregion #region Assert Assert.AreEqual(expected, result); #endregion }
public void TestGetSpecificAccount_GetAccountWhenNoAccount_Null() { #region Arrange Customer customer = new Customer("Per Persson"); #endregion #region Act Account result = customer.GetSpecificAccount("Savings account"); Account expected = null; #endregion #region Assert Assert.AreEqual(expected, result); #endregion }
public void TestGetAllAccounts_GetAccountsWhenTwoAccounts_ListWithTwoAccounts() { #region Arrange Customer customer = new Customer("Sven Svensson"); Account accountOne = new Account("Poker winnings", 6500, false); Account accountTwo = new Account("Stryktipset winnings", 14500, false); customer.AddAccount(accountOne); customer.AddAccount(accountTwo); #endregion #region Act int result = customer.GetAllAccounts().Count; int expected = 2; #endregion #region Assert Assert.AreEqual(expected, result); #endregion }
/// <summary> /// Method that will let teller to open a new account for customer. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void openActBtn_Click(object sender, EventArgs e) { if (name.Text.Length == 0 || address.Text.Length == 0 || amount.Text.Length == 0) { MessageBox.Show("Please fill out the full information!"); } else { double bal = Convert.ToDouble(amount.Text); c = new Customer(name.Text, address.Text, (list.Count),(list.Count+100),bal); list.Add(c); dbase.save(list); name.Text = ""; address.Text = ""; amount.Text = ""; MessageBox.Show("Customer Created Succesfully,\n\nCustomer Number will be: 00" + (list.Count - 1)+"\nAccount number will be: 0"+(list.Count+100)); } //x(sender, e); //List of Customer and pass the parameter of Customer object and then pass C into it, may want to use delegates.s }
//Add customer public void AddCustomer(Customer customerToAdd) { var addCustomer = ( from customer in this.customers where (customer.CustomerID == customerToAdd.CustomerID) || (customer.Pin == customerToAdd.Pin && customer.GetType() == customerToAdd.GetType()) select customer).ToList(); if (addCustomer.Count != 0) { throw new ArgumentException(String.Format("Customer with ID: {0} or PIN: {1} already exists in the system!", customerToAdd.CustomerID, customerToAdd.Pin)); } this.customers.Add(customerToAdd); OnCustomerOperation(new CustomerOperationsEventArgs(customerToAdd.CustomerID, customerToAdd.FirstName, customerToAdd.LastName, customerToAdd.Pin, "ADD", customerToAdd.GetType().Name)); }
public Loan(Customer cust, decimal interest) : base(cust, interest) { }
public void TestInstantiateCustomer_EmptyNameString_EmptyNameString() { #region Arrange Customer customer = new Customer(""); #endregion #region Act string resultName = customer.Name; string expectedName = ""; #endregion #region Assert Assert.AreEqual(expectedName, resultName); #endregion }
protected Account(Customer accCust, decimal interest) : this(accCust, interest, DateTime.Now, 0m) { }
// Constructors public DepositAccount(AccountType type, AccountCurrency currency, AccountPeriod period, Customer owner, long accountNumber) : base(type, currency, period, owner, accountNumber) { }
public Deposit(Customer cust, decimal interest) : base(cust, interest) { }
public Mortgage(Customer cust, decimal interest) : base(cust, interest) { }
/// <summary> /// This method will just load a customer when the progarm begins. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tellr_Load(object sender, EventArgs e) { Customer c1 = new Customer("D, Trump", "Atlantic City,NJ", 000, 100, 80); list.Add(c1); dbase.save(list); MessageBox.Show(list.Count + " Customer found in Database!"); }
public void TestInstantiateCustomer_SvenSvensson_SvenSvensson() { #region Arrange Customer customer = new Customer("Sven Svensson"); #endregion #region Act string resultName = customer.Name; string expectedName = "Sven Svensson"; #endregion #region Assert Assert.AreEqual(expectedName, resultName); #endregion }
public BankHandler() { theCustomer = new Customer("Customer"); initialAccount = new Account("Vacation savings", 7700.50, false); theCustomer.AddAccount(initialAccount); }
public void TestGetAllAccounts_GetAccountsWhenNoAccounts_EmptyList() { #region Arrange Customer customer = new Customer("Sven Svensson"); #endregion #region Act int result = customer.GetAllAccounts().Count; int expected = 0; #endregion #region Assert Assert.AreEqual(expected, result); #endregion }
protected Account(Customer customer, decimal balance, decimal interestRate) { this.AccountHolder = customer; this.Balance = balance; this.InterestRate = interestRate; }
public Loan(Customer cust, decimal interest, DateTime date, decimal saldo) : base(cust, interest, date, saldo) { }
public MortgageAccount(Customer customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
public DepositAccount(Customer customer, decimal balance, decimal interestRate) : base(customer, balance, interestRate) { }
public Account(Customer customer, decimal balance, decimal interestRate) { this.Customer = customer; this.Balance = balance; this.InterestRate = interestRate; }
public void RemoveCustomer(Customer customer) { this.customers.Remove(customer); }
/// <summary> /// This method will update the changes to the customer that has been stored in the list/Database. /// </summary> /// <param name="w"></param> /// <param name="x"></param> public void update(Customer w, int x) { lock (this) this.cust[x] = w; }