Beispiel #1
0
 /// <summary>
 /// Creates a new expense object with the given rate, account and frequency
 /// </summary>
 /// <param name="rate">Rate to withdraw from the specified account</param>
 /// <param name="acct">Account to withdraw the rate from</param>
 /// <param name="frequency">How often to withdraw the rate from the account</param>
 /// <param name="repPosition">What day, minute, hour, second, weekday, etc... to repeat this rate on</param>
 public AExpense(double rate = 0, IAccount acct = null, ExpenseRepetition frequency = ExpenseRepetition.None, RepetitionPosition repPosition = null) : base()
 {
     Rate = rate;
     AssignAccount(acct ?? new AAccount());
     if (frequency != ExpenseRepetition.None)
     {
         RepetitionFrequency = frequency;
         repetitionPosition  = repPosition ?? new RepetitionPosition();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new expense object with the given rate, accounts and frequency
 /// </summary>
 /// <param name="rate">Rate to withdraw from the specified account</param>
 /// <param name="accts">Accounts to withdraw the rate from</param>
 /// <param name="frequency">How often to withdraw the rate from the account</param>
 /// <param name="repPosition">What day, minute, hour, second, weekday, etc... to repeat this rate on</param>
 public AExpense(double rate, ICollection <IAccount> accts,
                 ExpenseRepetition frequency = ExpenseRepetition.None, RepetitionPosition repPosition = null) : base()
 {
     Rate = rate;
     foreach (IAccount acct in accts)
     {
         AssignAccount(acct);
     }
     if (frequency != ExpenseRepetition.None)
     {
         RepetitionFrequency = frequency;
         repetitionPosition  = repPosition ?? new RepetitionPosition();
     }
 }
Beispiel #3
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);
        }
Beispiel #4
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);
        }