Example #1
0
        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();
            }
        }
Example #2
0
        public ActionResult AddAccount(int CustomerId)
        {
            var model = new AddAccountDetails();

            model.CustomerId = CustomerId;
            return(View(model));
        }
Example #3
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);
     }
 }
Example #4
0
        public ActionResult AddAccount(AddAccountDetails model)
        {
            var employeeId = _employeeService.GetEmployeeId(User.Identity.Name);
            var bankId     = _employeeService.GetBankId(employeeId);
            var customer   = _customerService.GetCustomer(model.CustomerId);

            if (_accountService.AccountExist(model.AccountNumber.Value, bankId))
            {
                ModelState.AddModelError("Account", "The account number is already an account at this bank.");
                return(View(model));
            }
            _accountService.CreateAccountForCustomer(customer.Username, bankId, new AccountBO
            {
                Name   = model.AccountName,
                Number = model.AccountNumber.Value,
                Type   = new AccountType
                {
                    Name = model.AccountType
                }
            });
            _accountService.GiveUserAccessToAccount(customer.Username, "Owner", model.AccountNumber.Value);
            return(RedirectToAction("CustomerAccounts", new { customerId = model.CustomerId }));
        }