private void ParseFormDataAndAddNewCurrentAccount(AddData ad)
        {
            AddAccountDetails addNewCurrentAccount = new AddAccountDetails();

            //Account addAcc = new CurrentAccount();
            addNewCurrentAccount.FirstName = txtFName.Text;
            addNewCurrentAccount.Surname   = txtSurname.Text;
            //Email email = new Email(txtEmail.Text);
            addNewCurrentAccount.Email = new Email(txtEmail.Text);
            //Phone phone = new Phone(txtPhone.Text);
            addNewCurrentAccount.Phone        = new Phone(txtPhone.Text);
            addNewCurrentAccount.AddressLine1 = txtAddress1.Text;
            addNewCurrentAccount.AddressLine2 = txtAddress2.Text;
            addNewCurrentAccount.City         = txtCity.Text;
            addNewCurrentAccount.County       = cbxCounty.Items[cbxCounty.SelectedIndex].ToString();
            addNewCurrentAccount.AccountType  = cbxAccountType.Items[cbxAccountType.SelectedIndex].ToString();
            //AccountNumber accNo = new AccountNumber(txtAccountNumber.Text);
            addNewCurrentAccount.AccountNumber  = new AccountNumber(txtAccountNumber.Text);
            addNewCurrentAccount.SortCode       = txtSortCode.Text;
            addNewCurrentAccount.OpeningBalance = decimal.Parse(txtOpeningBalance.Text);
            addNewCurrentAccount.Overdraft      = decimal.Parse(txtOverdraftLimit.Text);


            //check account number is 8 digits
            if (txtAccountNumber.Text.Length == 8)
            {
                ad.AddCurrentAccount(addNewCurrentAccount);
                CloseCon();
            }
            else
            {
                AccountNumberLengthErrorMessage();
            }
        }
Exemple #2
0
 //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);
     }
 }