public void SaveAccount(Account account) { if (account != null) { ATM.AccountDataTable accountDataTable = AccountAdapter.GetAccountByAccountNumber(account.AccountNumber); ATM.AccountRow accountRow = (ATM.AccountRow)accountDataTable.Rows[0]; if (account is SavingsAccount) { accountRow.SavingsBalance = account.Balance; } else if (account is CheckingAccount) { accountRow.Checking_Balance = account.Balance; } AccountAdapter.Update(accountDataTable); } }
/// <summary> /// Creates the account. /// </summary> /// <param name="accountRow">The account row.</param> /// <returns></returns> protected List <Account> createAccount(ATM.AccountRow accountRow) { List <Account> accounts = new List <Account>(); if (accountRow.AccountType == (short)AccountType.Both || accountRow.AccountType == (short)AccountType.Checking) { CheckingAccount checking = new CheckingAccount(accountRow.AccountNumber, accountRow.Checking_Balance); checking.Status = ObjectStatus.Clean; accounts.Add(checking); } if (accountRow.AccountType == (short)AccountType.Both || accountRow.AccountType == (short)AccountType.Savings) { SavingsAccount savings = new SavingsAccount(accountRow.AccountNumber, accountRow.SavingsBalance); savings.Status = ObjectStatus.Clean; accounts.Add(savings); } return(accounts); }