private void FillOutgoSumm(List <MonthSumm> listmonths, ReportMonthsModel model) { for (int i = 0; i < listmonths.Count; i++) { model.MonthInOuts[i].SummOut = listmonths[i].Summ.ToString("c"); } }
private void FillMonths(IEnumerable <MonthSumm> listMonths, ReportMonthsModel model) { listMonths.ForEach(x => model.MonthInOuts.Add(new MonthInOut() { Month = x.Date, Date = DateTime.Parse(x.Date) })); }
private void FillOutgoSumm(List <MonthSumm> listmonths, ReportMonthsModel model) { foreach (var monthSumm in listmonths) { foreach (var monthInOut in model.MonthInOuts) { if (monthInOut.Month != monthSumm.Date) { continue; } monthInOut.SummOut = monthSumm.Summ.ToString("C"); break; } } }
public PartialViewResult OverallLastYearMonths(WebUser user) { var model = new ReportMonthsModel(); try { var tempQuery = _reportControllerHelper.GetPayingItemsForLastYear(user).ToList(); _reportControllerHelper.FillReportMonthsModel(model, tempQuery); return(PartialView("_OverallLastYearMonths", model)); } catch (WebUiHelperException e) { throw new WebUiException($"Ошибка в контроллере {nameof(ReportController)} в методе {nameof(OverallLastYearMonths)}", e); } }
public void FillReportMonthsModel(ReportMonthsModel model, List <PayingItem> repo) { var income = GetOverallByTypeOfFlow(repo, 1); var outgo = GetOverallByTypeOfFlow(repo, 2); model.MonthInOuts = new List <MonthInOut>(); if (income.Count > outgo.Count) { FillMonths(income, model); FillIncomeSumm(income, model); FillOutgoSumm(outgo, model); } else { FillMonths(outgo, model); FillIncomeSumm(income, model); FillOutgoSumm(outgo, model); } model.MonthInOuts.Reverse(); }