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(); }