Example #1
0
        private List <MonthlyView> BuildMonthlyView(decimal initialAmount)
        {
            if (statements == null || statements.Count == 0)
            {
                return(new List <MonthlyView>());
            }

            List <MonthlyView> monthViews = new List <MonthlyView>();

            decimal previousAmount = initialAmount;

            foreach (var yearMonth in GetMonthYearList())
            {
                List <TransactionLine> currentMonthLines = statements.Where(x => yearMonth.Equals(x.TransactionDate)).OrderBy(x => x.TransactionDate).ToList();
                MonthlyView            month             = BuildMonth(yearMonth, previousAmount, currentMonthLines);
                monthViews.Add(month);
                previousAmount = month.FinalAmount;
            }

            foreach (IViewerPipeline pipe in pipelines)
            {
                pipe.ProcessViews(monthViews);
            }

            return(monthViews);
        }
Example #2
0
        private MonthlyView BuildMonth(YearMonth yearMonth, decimal initialAmount, List <TransactionLine> monthlyStatements)
        {
            MonthlyView result = new MonthlyView(yearMonth, initialAmount);

            foreach (var item in monthlyStatements)
            {
                result.Add(item);
            }

            return(result);
        }