//manages a deposit or withdrawal public string DepWith(string sType, string sUser, string sAmmount) { Customer myCustomer = new Customer(); try { string sAccount = myCustomer.GetAccount(sUser); if (sType.Equals("WITHDRAW")) if (GetBalance(sAccount) < double.Parse(sAmmount)) return "0"; return Create(sType, sAmmount, sAccount); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return "-1"; } }
//returns customer's balance (and customer account's turnover) public string Balance(string sUser, string sMode) { Customer myCustomer = new Customer(); try { string sAccount = myCustomer.GetAccount(sUser); if (sMode.Equals("N")) return "Current balance on your cash account is: " + GetBalance(sAccount).ToString(); return "Current balance on your cash account is: " + GetBalance(sAccount).ToString() + "\n" + GetTurnover(sAccount); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return "-1"; } }