示例#1
0
 public virtual IncomeValue AddIncomeValue(Budget budget, decimal value, DateTime date, string description)
 {
     IncomeValue incomeValue = new IncomeValue
     {
         Date        = date,
         Income      = this,
         Value       = value,
         Description = description,
         Budget      = budget,
     };
     Values.Add(incomeValue);
     return incomeValue;
 }
 public BudgetPlanItemVM(Budget budget, CashFlow cashFlow, IEnumerable<BudgetPlan> planItems)
 {
     Budget = budget;
     CashFlow = cashFlow;
     Values = new BindableCollectionExt<BudgetPlan>(planItems);
     Values.CollectionChanged += (s, e) =>
         {
             if (e.Action == NotifyCollectionChangedAction.Remove)
             {
                 var item = e.OldItems[0] as BudgetPlan;
                 Budget.BudgetPlanItems.Remove(item);
             }
             RefreshUI();
         };
     Values.PropertyChanged += (s, e) => { RefreshUI(); };
 }
示例#3
0
 public virtual SavingValue Withdraw(decimal value, DateTime date, string description, Budget withdrawToBudget)
 {
     SavingValue newSavingValue = new SavingValue
     {
         Saving      = this,
         Date        = date,
         Value       = -value,
         Description = description,
         Budget      = withdrawToBudget,
         Expense     = new Expense(),
     };
     newSavingValue.UpdateDescription();
     Values.Add(newSavingValue);
     return newSavingValue;
 }
示例#4
0
 public void DepositSavingValue(Budget budget, Expense expense, decimal value, DateTime date)
 {
     throw new NotImplementedException();
 }
        public void LoadData(Budget budget)
        {
            Budget = budget;
            BudgetIncomeValues = Budget.IncomeValues as BindableCollectionExt<IncomeValue>;
            BudgetIncomeValues.PropertyChanged += (s, e) => { SaveRevenue(s as Entity); };
            NotifyOfPropertyChange(() => BudgetIncomeValues);

            BudgetSavingValues = Budget.SavingValues as BindableCollectionExt<SavingValue>;
            BudgetSavingValues.PropertyChanged += (s, e) => { SaveRevenue(s as Entity); };
            NotifyOfPropertyChange(() => BudgetSavingValues);

            LoadIncomes();
            LoadSavings();
            RefreshSummaryValues();
        }
示例#6
0
        public static Budget CreateEmptyForDate(DateTime contextDate, IEnumerable<CashFlow> cashFlows)
        {
            DateTime dateFrom = new DateTime(contextDate.Year, contextDate.Month, 1);
            DateTime dateTo = dateFrom.AddMonths(1).AddDays(-1);
            Budget budget = new Budget
            {
                DateFrom = dateFrom,
                DateTo = dateTo,
            };

            return budget;
        }
示例#7
0
        public static Expense CreateExpense(Budget budget, CashFlow flow, decimal value, string description, DateTime date)
        {
            var expense = new Expense
            {
                Description = description,
                Date        = date,
                Budget      = budget,
            };

            expense._value = value;
            expense._flow  = flow;

            if (flow.Saving != null)
            {
                expense.SavingValue = flow.Saving.Deposit(expense, value, date, description);
            }

            return expense;
        }
        public void LoadData(Budget budget)
        {
            Diagnostics.Start();
            Budget = budget;

            FillFilterData();
            Diagnostics.Start();
        }
 public void LoadData(Budget budget)
 {
     Budget = budget;
     LoadBudgetPlanItems();
 }