public int CalculateBudget(DateTime startDate, DateTime endDate) { Period period = new Period(startDate, endDate); period.IsInvalid(); IEnumerable <Budget> ieBg = this._respository.GetBudgets(new[] { new BudgetSearcher(startDate.Year, startDate.Month), new BudgetSearcher(endDate.Year, endDate.Month) }); BudgeProcessor processor = new BudgeProcessor(period, ieBg); return(period.IsTheSameMonth() ? processor.CalculateTheSameMonth() : processor.CalculateDifferentMonth()); }
public int CalculateBudget(DateTime startDate, DateTime endDate) { if (endDate < startDate) { throw new ArgumentException(); } IEnumerable <Budget> ieBg = this._respository.GetBudgets(new[] { new BudgetSearcher(startDate.Year, startDate.Month), new BudgetSearcher(endDate.Year, endDate.Month) }); this._processor = new BudgeProcessor(startDate, endDate, ieBg); return(_processor.IsTheSameYear() ? _processor.IsTheSameMonth() ? _processor.CalculateTheSameMonth() : _processor.CalculateDifferentMonth() : _processor.CalculateDifferentMonth()); }