コード例 #1
0
ファイル: Income.cs プロジェクト: adalbertus/BudgetPlanner
 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;
 }
コード例 #2
0
 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
ファイル: Saving.cs プロジェクト: adalbertus/BudgetPlanner
 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
ファイル: Saving.cs プロジェクト: adalbertus/BudgetPlanner
 public void DepositSavingValue(Budget budget, Expense expense, decimal value, DateTime date)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
        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
ファイル: Budget.cs プロジェクト: adalbertus/BudgetPlanner
        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
ファイル: Expense.cs プロジェクト: adalbertus/BudgetPlanner
        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;
        }
コード例 #8
0
        public void LoadData(Budget budget)
        {
            Diagnostics.Start();
            Budget = budget;

            FillFilterData();
            Diagnostics.Start();
        }
コード例 #9
0
 public void LoadData(Budget budget)
 {
     Budget = budget;
     LoadBudgetPlanItems();
 }