Esempio n. 1
0
        public ActionResult DailyVolume(DailyVolumeListModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;

            if (filter == null)
            {
                filter = new DailyVolumeListModelFilter {
                    FromDate = DateTime.Today.AddDays(-1), ToDate = DateTime.Today.AddDays(-1)
                }
            }
            ;

            var model = _eventReportingService.GetDailyVolumeReport(pageNumber, _pageSize, filter, out totalRecords) ??
                        new DailyVolumeListModel();

            model.Filter = filter;

            var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
            Func <int, string> urlFunc = pn => Url.Action(currentAction, new
            {
                pageNumber = pn,
                filter.FromDate,
                filter.ToDate,
                filter.Pod,
                filter.HealthPlanId,
                IsRetail     = filter.IsRetailEvent,
                IsCorporate  = filter.IsCorporateEvent,
                IsHealthPlan = filter.IsHealthPlanEvent,
            });

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);
            return(View(model));
        }
Esempio n. 2
0
        public void PollForDailyVolumeReport()
        {
            try
            {
                _logger.Info("Setting filter to pull data for Daily Volume Report");
                var filter = new DailyVolumeListModelFilter
                {
                    FromDate = new DateTime(DateTime.Today.Year, 1, 1),
                    ToDate   = new DateTime(DateTime.Today.Year, 12, 31)
                };

                _logger.Info("fetching Daily Volume Report");
                var dataGen = new ExportableDataGenerator <DailyVolumeModel, DailyVolumeListModelFilter>(_eventReportingService.GetDailyVolumeReport, _logger);
                var model   = dataGen.GetData(filter);

                if (model != null && !model.Collection.IsNullOrEmpty())
                {
                    _logger.Info("Writing Daily volume Report");
                    var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <DailyVolumeModel>();

                    _logger.Info("Record count" + model.Collection.Count());
                    var dailyVolumeReportPath = Path.Combine(_settings.DailyVolumeReportPath, DateTime.Today.Year.ToString());

                    DirectoryOperationsHelper.CreateDirectoryIfNotExist(dailyVolumeReportPath);
                    var reportName     = "HF_DailyVolume_" + DateTime.Today.ToString("yyyyMMdd") + ".csv";
                    var reportfilePath = Path.Combine(dailyVolumeReportPath, reportName);

                    DirectoryOperationsHelper.DeleteFileIfExist(reportfilePath);

                    _baseExportableReportHelper.GenerateCsv(reportfilePath, exporter, model.Collection);

                    _logger.Info("Daily Volume Report File Posted " + reportfilePath);
                }
            }
            catch (Exception exception)
            {
                _logger.Error("Some error occurred ");
                _logger.Error("Message:  " + exception.Message);
                _logger.Error("Stack Trace:  " + exception.StackTrace);
            }
        }