Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Ok then perhaps this will help:</p> <p>Update the Customer class with a Generic Account List property.</p> <pre><code> private int numberAccounts; public List&lt;Account&gt; Accounts { get; protected set; } public Customer(string theCustomerNumber, string theCustomerTitle, string theFirstName, string theInitials, string theSurname, string theDateOfBirth, string theHouseNameNumber, string theStreetName, string theArea, string theCityTown, string theCounty, string thePostcode, string thePassword, string theNumberAccounts) { customerNumber = theCustomerNumber; customerTitle = theCustomerTitle; firstName = theFirstName; initials = theInitials; surname = theSurname; dateOfBirth = theDateOfBirth; houseNameNumber = theHouseNameNumber; streetName = theStreetName; area = theArea; cityTown = theCityTown; county = theCounty; postcode = thePostcode; password = thePassword; setNumberAccounts(theNumberAccounts); Accounts = new List&lt;Account&gt;(); } </code></pre> <p>Update the Account with a Generic Transaction List Property</p> <pre><code>public List&lt;Transaction&gt; Transactions { get; protected set; } public Account(string theAccSort, string theAccNumber, string theAccNick, string theAccDate, string theAccCurBal, string theAccOverDraft, string theAccNumTrans) { accSort = theAccSort; setAccNumber(theAccNumber); accNick = theAccNick; accDate = theAccDate; setAccCurBal(theAccCurBal); setAccOverDraft(theAccOverDraft); setAccNumTrans(theAccNumTrans); Transactions = new List&lt;Transaction&gt;(); } </code></pre> <p>Comment out your "readData()" method and replace with this:</p> <pre><code> private void readData() { ///read all the data into memory (if you can) string[] _data = File.ReadAllLines(inputDataFile); Queue&lt;String&gt; _lines = new Queue&lt;string&gt;(); foreach (string _line in _data) { _lines.Enqueue(_line.Trim()); //put it into a queue for convience } ///iterate through the data and extract the details based on ///known record delimiters. while (_lines.Count &gt; 0) { Customer _customer = new Customer( _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue()); int _numberOfAccounts = _customer.getNumberAccounts(); for (int i = 1; i &lt;= _numberOfAccounts; i++) { Account _account = new Account( _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue()); int _numberOfTransactions = _account.getAccNumTrans(); for (int j = 1; j &lt;= _numberOfTransactions; j++) { Transaction _transaction = new Transaction( _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue(), _lines.Dequeue()); _account.Transactions.Add(_transaction); } _customer.Accounts.Add(_account); } ///update the legacy part of the system. bankDetails.Add(_customer); foreach (Account _account in _customer.Accounts) { accDetails.Add(_account); foreach (Transaction _transaction in _account.Transactions) { tranDetails.Add(_transaction); } } } } </code></pre> <p>EDIT: Comment out your "showListsOfCust" method and put this in it's place</p> <pre><code>private void showListsOfCust() { listBox1.Items.Clear(); foreach (Customer c in bankDetails) { listBox1.Items.Add(c.getCustomerNumber() + " " + c.getCustomerTitle() + " " + c.getFirstName() + " " + c.getInitials() + " " + c.getSurname() + " " + c.getDateOfBirth() + " " + c.getHouseNameNumber() + " " + c.getStreetName() + " " + c.getArea() + " " + c.getCityTown() + " " + c.getCounty() + " " + c.getPostcode() + " " + c.getPassword() + " " + c.getNumberAccounts()); foreach (Account a in c.Accounts) { listBox1.Items.Add(a.getAccSort() + " " + a.getAccNumber() + " " + a.getAccNick() + " " + a.getAccDate() + " " + a.getAccCurBal() + " " + a.getAccOverDraft() + " " + a.getAccNumTrans()); foreach (Transaction t in a.Transactions) { listBox1.Items.Add(t.getDate() + " " + t.getType() + " " + t.getDescription() + " " + t.getAmount() + " " + t.getBalAfter()); } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload