public double CalculateCurrentBudget(Budget budget) { return(budget.Amount - CalculateSavings(budget) - SumPastExpenses(budget)); }
public double CalculateRemainingBudget(Budget budget) { return(CalculateCurrentBudget(budget) - CalculateTodaysAllowance(budget)); }
public double SumPastExpenses(Budget budget) { return(GetPastExpenses(budget).Sum(expense => expense.Amount)); }
public double SumTodaysExpenses(Budget budget) { return(GetTodaysExpenses(budget).Sum(expense => expense.Amount)); }
public IEnumerable <Expense> GetTodaysExpenses(Budget budget) { return(budget.Expenses.Where(expense => expense.Date == _dateProvider.Today())); }
public bool IsTodayInBudgetScope(Budget budget) { return(_dateProvider.Today() >= budget.Start && _dateProvider.Today() <= budget.End); }
public int GetNumberOfTotalDays(Budget budget) { return((int)(budget.End - budget.Start).TotalDays + 1); }
public int GetNumberOfRemainingDays(Budget budget) { return(_dateProvider.Today() < budget.End ? (int)(budget.End - _dateProvider.Today()).TotalDays : 0); }
public int GetNumberOfPastDays(Budget budget) { return(_dateProvider.Today() > budget.Start ? (int)(_dateProvider.Today() - budget.Start).TotalDays : 0); }