Exemplo n.º 1
0
        private void frmAccountView_Load(object sender, EventArgs e)
        {
            tmrDateTime_Tick(sender, e);
            int       currentCustomerNum    = fileClass.getcurrentCustomerNum();
            int       currentAccountNum     = fileClass.getcurrentAccountNum();
            int       currentTransactionNum = 0;
            ArrayList returnedData          = fileClass.readFile();

            Customer  thisCustomer = (Customer)returnedData[currentCustomerNum];
            ArrayList accountList  = thisCustomer.getaccountList();
            Account   thisAccount  = (Account)accountList[currentAccountNum];

            lblCustomer.Text        = thisCustomer.getfirstName() + " " + thisCustomer.getsurname() + " - " + thisCustomer.getpostcode();
            lblAccountNickName.Text = thisAccount.getnickName();
            lblAccountNumber.Text   = Convert.ToString(thisAccount.getaccountNumber());
            lblAccountSortCode.Text = thisAccount.getsortCode();
            lblAccountBalance.Text  = String.Format("{0:c}", thisAccount.getcurrentBalance());

            foreach (Transaction oneTransaction in thisAccount.gettransactionList())
            {
                DataGridViewRow  dgvRow  = new DataGridViewRow();
                DataGridViewCell dgvCell = new DataGridViewTextBoxCell();

                dgvCell.Value = currentTransactionNum;
                dgvRow.Cells.Add(dgvCell);

                dgvCell       = new DataGridViewTextBoxCell();
                dgvCell.Value = oneTransaction.getdate();
                dgvRow.Cells.Add(dgvCell);

                dgvCell       = new DataGridViewTextBoxCell();
                dgvCell.Value = oneTransaction.gettype();
                dgvRow.Cells.Add(dgvCell);

                dgvCell       = new DataGridViewTextBoxCell();
                dgvCell.Value = oneTransaction.getdescription();
                dgvRow.Cells.Add(dgvCell);

                dgvCell       = new DataGridViewTextBoxCell();
                dgvCell.Value = oneTransaction.getamount();
                dgvRow.Cells.Add(dgvCell);

                dgvCell       = new DataGridViewTextBoxCell();
                dgvCell.Value = oneTransaction.getbalanceAfter();
                dgvRow.Cells.Add(dgvCell);

                dgvTransactions.Rows.Add(dgvRow);
                currentTransactionNum++;
            }

            dgvTransactions.Refresh();
        }