private void ParseFormDataAndAddNewSavingsAccount(AddData ad) { AddAccountDetails addNewSavingAccount = new AddAccountDetails(); txtOverdraftLimit.Text = "0"; addNewSavingAccount.FirstName = txtFName.Text; addNewSavingAccount.Surname = txtFName.Text; addNewSavingAccount.Email = new Email(txtEmail.Text); addNewSavingAccount.Phone = new Phone(txtPhone.Text); addNewSavingAccount.AddressLine1 = txtAddress1.Text; addNewSavingAccount.AddressLine2 = txtAddress2.Text; addNewSavingAccount.City = txtCity.Text; addNewSavingAccount.County = cbxCounty.Items[cbxCounty.SelectedIndex].ToString(); addNewSavingAccount.AccountType = cbxAccountType.Items[cbxAccountType.SelectedIndex].ToString(); addNewSavingAccount.AccountNumber = new AccountNumber(txtAccountNumber.Text); addNewSavingAccount.SortCode = txtSortCode.Text; addNewSavingAccount.OpeningBalance = decimal.Parse(txtOpeningBalance.Text); addNewSavingAccount.Overdraft = decimal.Parse(txtOverdraftLimit.Text); //check account number is 8 digits if (txtAccountNumber.Text.Length == 8) { ad.AddSavingsAccount(addNewSavingAccount); CloseCon(); } else { AccountNumberLengthErrorMessage(); } }
//method public void AddAccToDb() { if (OverdraftLimit != 0) { AddAccountDetails newAcc = new AddAccountDetails(); ad.AddSavingsAccount(newAcc); //ad.AddSavingsAccount(newAcc); //ad.AddSavingsAccount(FirstName, Surname, Email, Phone, Address1, Address2, City, County, AccountType, AccountNumber, sortcode, InitialBalance,OverdraftLimit); } else { AddAccountDetails newAcc = new AddAccountDetails(); ad.AddCurrentAccount(newAcc); // ad.AddCurrentAccount(FirstName, Surname, Email, Phone, Address1, Address2, City, County, AccountType, AccountNumber, sortcode, InitialBalance, OverdraftLimit); } }