Exemplo n.º 1
0
 public IncomeController(IIncomeRepository repo, ILogger <IncomeController> logger, PIMS3Context ctx)
 {
     _repo   = repo;
     _logger = logger;
     _ctx    = ctx;
     _incomeProcessingBusLogicComponent = new IncomeProcessing(_ctx);
 }
Exemplo n.º 2
0
        public IEnumerable <YtdRevenueSummaryVm> GetRevenueSummary(int yearsToBackDate, bool isRevenueSummary, string Id)
        {
            // isRevenueSummary param used only for URL routing here vs. GetRevenue().
            IEnumerable <Income> incomeData;
            IncomeProcessing     blComponent = new IncomeProcessing(_ctx);

            try
            {
                incomeData = _repo.GetRevenueSummaryForYear(yearsToBackDate, Id);
                IEnumerable <YtdRevenueSummaryVm> ytdRevenueSummary = blComponent.CalculateRevenueTotals(incomeData.AsQueryable());
                _incomeCount = new decimal[ytdRevenueSummary.Count()];
                ytdRevenueSummary.ToList().ForEach(CalculateAverages);
                //_logger.LogInformation("Successfull YTD income summary via GetRevenueSumary()");
                return(ytdRevenueSummary.OrderByDescending(r => r.MonthRecvd).ToList());
            }
            catch (Exception ex)
            {
                Log.Error($"Unable to fetch/calculate income due to: {ex.Message.ToString()}");
                return(null);
            }
        }