Ejemplo n.º 1
0
        public int CreateAccountInline(string title, string description = "", double initialBalance = 0)
        {
            AAccount acct = new AAccount(initialBalance)
            {
                Title       = title,
                Description = description
            };

            AddAccount(acct);
            return(acct.ID);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 private void aAccountForm1_ValueChangedEvent(object sender, EventArgs e)
 {
     Value = aAccountForm1.Value;
     OnValueChangedEvent();
 }