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(); }
private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; ArrayList returnedData = fileClass.readFile(); foreach (Customer oneCustomer in returnedData) { textBox1.Text += "Customer: " + oneCustomer.getfirstName() + " " + oneCustomer.getsurname() + Environment.NewLine; foreach (Account oneAccount in oneCustomer.getaccountList()) { textBox1.Text += " Account: " + oneAccount.getaccountNumber() + " (" + oneAccount.getnickName() + ") " + Environment.NewLine; foreach (Transaction oneTransaction in oneAccount.gettransactionList()) { textBox1.Text += " Transaction: " + oneTransaction.getdescription() + " " + String.Format("{0:c}", oneTransaction.getamount()) + Environment.NewLine; } } } }
private void frmCustomerView_Load(object sender, EventArgs e) { tmrDateTime_Tick(sender, e); int currentCustomerNum = fileClass.getcurrentCustomerNum(); int currentAccountNum = 0; ArrayList returnedData = fileClass.readFile(); Customer thisCustomer = (Customer)returnedData[currentCustomerNum]; lblCustomerName.Text = thisCustomer.getfirstName() + " " + thisCustomer.getsurname(); lblCustomerDOB.Text = thisCustomer.getdob(); lblCustomerHouseNameOrNum.Text = thisCustomer.gethouseNameNumber(); lblCustomerStreet.Text = thisCustomer.getstreetName(); lblCustomerAddress.Text = thisCustomer.getaddressArea(); lblCustomerTownOrCity.Text = thisCustomer.getcityTown(); lblCustomerCounty.Text = thisCustomer.getcounty(); lblCustomerPostcode.Text = thisCustomer.getpostcode(); foreach (Account oneAccount in thisCustomer.getaccountList()) { DataGridViewRow dgvRow = new DataGridViewRow(); DataGridViewCell dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = currentAccountNum; dgvRow.Cells.Add(dgvCell); dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = oneAccount.getnickName(); dgvRow.Cells.Add(dgvCell); dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = oneAccount.getcurrentBalance(); dgvRow.Cells.Add(dgvCell); dgvAccounts.Rows.Add(dgvRow); currentAccountNum++; } dgvAccounts.Refresh(); }
private void frmCustomerEdit_Load(object sender, EventArgs e) { tmrDateTime_Tick(sender, e); int currentCustomerNum = fileClass.getcurrentCustomerNum(); ArrayList returnedData = fileClass.readFile(); Customer thisCustomer = (Customer)returnedData[currentCustomerNum]; txtFirstName.Text = thisCustomer.getfirstName(); txtSurname.Text = thisCustomer.getsurname(); txtDob.Text = thisCustomer.getdob(); txtInitials.Text = thisCustomer.getinitials(); txtTitle.Text = thisCustomer.gettitle(); txtPassword.Text = thisCustomer.getpassword(); txtNumberName.Text = thisCustomer.gethouseNameNumber(); txtStreetName.Text = thisCustomer.getstreetName(); txtAddressArea.Text = thisCustomer.getaddressArea(); txtCityTown.Text = thisCustomer.getcityTown(); txtCounty.Text = thisCustomer.getcounty(); txtPostcode.Text = thisCustomer.getpostcode(); }
private void generateVerification() { int currentCustomerNum = fileClass.getcurrentCustomerNum(); ArrayList returnedData = fileClass.readFile(); Customer thisCustomer = (Customer)returnedData[currentCustomerNum]; txt1stChar.Text = ""; txt2ndChar.Text = ""; txt3rdChar.Text = ""; string password = thisCustomer.getpassword(); float passwordLen = password.Length; int char1s = 1; int char1f = Convert.ToInt32(Math.Floor(passwordLen / 3f)); int char2s = char1f + 1; int char2f = char2s + char1f; int char3s = char2f + 1; int char3f = Convert.ToInt32(passwordLen); Random random = new Random(); int randomNum = random.Next(char1s, char1f + 1); lbl1stChar.Text = "#" + randomNum; char1 = password[randomNum - 1]; randomNum = random.Next(char2s, char2f + 1); lbl2ndChar.Text = "#" + randomNum; char2 = password[randomNum - 1]; randomNum = random.Next(char3s, char3f + 1); lbl3rdChar.Text = "#" + randomNum; char3 = password[randomNum - 1]; txt1stChar.Focus(); }
private void searchForCustomer() { bool addCustomerToDgv = false; ArrayList returnedData = fileClass.readFile(); int currentCustomerNum = 0; int resultsShown = 0; dgvCustomers.Rows.Clear(); foreach (Customer oneCustomer in returnedData) { addCustomerToDgv = false; //make this false if (Regex.IsMatch(oneCustomer.getfirstName(), txtSearchTerm.Text, RegexOptions.IgnoreCase)) { addCustomerToDgv = true; } if (Regex.IsMatch(oneCustomer.getsurname(), txtSearchTerm.Text, RegexOptions.IgnoreCase)) { addCustomerToDgv = true; } if (Regex.IsMatch(oneCustomer.getpostcode(), txtSearchTerm.Text, RegexOptions.IgnoreCase)) { addCustomerToDgv = true; } if (Regex.IsMatch(oneCustomer.getcityTown(), txtSearchTerm.Text, RegexOptions.IgnoreCase)) { addCustomerToDgv = true; } if (Regex.IsMatch(oneCustomer.getcounty(), txtSearchTerm.Text, RegexOptions.IgnoreCase)) { addCustomerToDgv = true; } if (addCustomerToDgv) { DataGridViewRow dgvRow = new DataGridViewRow(); DataGridViewCell dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = currentCustomerNum; dgvRow.Cells.Add(dgvCell); dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = oneCustomer.getfirstName() + " " + oneCustomer.getinitials() + " " + oneCustomer.getsurname(); dgvRow.Cells.Add(dgvCell); dgvCell = new DataGridViewTextBoxCell(); dgvCell.Value = oneCustomer.gethouseNameNumber() + " " + oneCustomer.getstreetName() + ", " + oneCustomer.getpostcode(); dgvRow.Cells.Add(dgvCell); dgvCustomers.Rows.Add(dgvRow); resultsShown++; } currentCustomerNum++; } dgvCustomers.Refresh(); if (resultsShown == 0) { lblResult.Text = "No results"; } else if (resultsShown == 1) { lblResult.Text = "1 result"; } else { lblResult.Text = resultsShown + " results"; } }