public CustomerAccount(string namein, string addressin, decimal balancein) { Name = namein; Address = addressin; Balance = balancein; Overdraft = CUSTOMER_ACCOUNT_OVERDRAFT; AccountNumber = AbstAccountFields.GetNewAccountNumber(); AbstDictionaryBank.StoreNewAccount(this); AbstFileHandling.SaveAccountToDisk(this); }
//load baby account details not catered for yet public static IAccount LoadAccountDetails(int accountnumin) { IAccount result = null; System.IO.TextReader textIn = null; bool foundAccount = false; try { textIn = new System.IO.StreamReader("Customer Account Details.txt"); do { string nameText = textIn.ReadLine(); string addressText = textIn.ReadLine(); string accountText = textIn.ReadLine(); string balanceText = textIn.ReadLine(); int accountNum = int.Parse(accountText); if (accountNum == accountnumin) { foundAccount = true; decimal balance = decimal.Parse(balanceText); //result = new BabyAccount(nameText, addressText, balance); result = AbstDictionaryBank.FindAccountWithAccountNum(accountNum); } } while (foundAccount == false); } catch { return(null); } finally { if (textIn != null) { textIn.Close(); } } return(result); }