public int CreateAccountInline(string title, string description = "", double initialBalance = 0) { AAccount acct = new AAccount(initialBalance) { Title = title, Description = description }; AddAccount(acct); return(acct.ID); }
public IAccount findAccount(int id) { AAccount comp = new AAccount(); comp.AssignID(id); if (Accounts.Contains(comp)) { int index = Accounts.ToList().IndexOf(comp); return(Accounts.ElementAt(index)); } else { return(null); } }
public int CreateExpenseInline(string title, string description, double fee, int acct, ExpenseRepetition repetition = ExpenseRepetition.None, RepetitionPosition position = null) { if (findAccount(acct) == null) { AAccount account = new AAccount(); account.AssignID(acct); if (!AddAccount(account)) { throw new InvalidOperationException("Account didn't exist and creation of new account failed!"); } } AExpense exp = new AExpense(fee, findAccount(acct), repetition, position); AddExpense(exp); return(exp.ID); }
public int CreateExpenseInline(string title, string description, double fee, IEnumerable <int> accts, ExpenseRepetition repetition = ExpenseRepetition.None, RepetitionPosition position = null) { List <IAccount> accounts = new List <IAccount>(accts.Count()); foreach (int acct in accts) { if (findAccount(acct) == null) { AAccount account = new AAccount(); account.AssignID(acct); if (!AddAccount(account)) { throw new InvalidOperationException("Account didn't exist and creation of new account failed!"); } } accounts.Add(findAccount(acct)); } AExpense exp = new AExpense(fee, accounts, repetition, position); AddExpense(exp); return(exp.ID); }
private void aAccountForm1_ValueChangedEvent(object sender, EventArgs e) { Value = aAccountForm1.Value; OnValueChangedEvent(); }