public string CustomerScheduleExport(CustomerScheduleModelFilter filter, long userId)
        {
            var fileName    = GetExportableFileName("CustomerSchedule");
            var csvFilePath = Path.Combine(ExportableMediaLocation.PhysicalPath, fileName);

            var dataGen = new ExportableDataGenerator <EventCustomerScheduleModel, CustomerScheduleModelFilter>(_eventCustomerReportingService.GetCustomerScheduleModel, Logger);

            var model = dataGen.GetData(filter);

            var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <CustomerScheduleModel>();

            var csvStringBuilder = _customerScheduleCsvHelper.GetPatientScheduledReport(model.Collection, exporter);

            var request = new GenericReportRequest {
                CsvFilePath = csvFilePath, Model = csvStringBuilder.ToString()
            };
            var isGenerated = _baseReportService.GetResponse(request);

            if (!isGenerated)
            {
                return("CSV File Export failed!");
            }

            return(_baseReportService.DownloadZipFile(ExportableMediaLocation, fileName, userId, Logger));
        }
示例#2
0
        public ActionResult CustomerSchedule(CustomerScheduleModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;
            var model = _eventCustomerReportingService.GetCustomerScheduleModel(pageNumber, _pageSize, filter, out totalRecords) ??
                        new EventCustomerScheduleListModel();

            model.Filter = filter;

            var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
            Func <int, string> urlFunc =
                pn =>
                Url.Action(currentAction,
                           new
            {
                pageNumber = pn,
                filter.Vehicle,
                filter.FromDate,
                filter.ToDate,
                filter.IsCorporateEvent,
                filter.IsRetailEvent,
                filter.IsPublicEvent,
                filter.IsPrivateEvent
            });

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);

            return(View(model));
        }
        public void GetEventCustomersforPateintSchedulewithFiltersTest()
        {
            int totalRecords = 0;
            var filter       = new CustomerScheduleModelFilter()
            {
                IsCorporateEvent = false,
                IsRetailEvent    = true
            };

            var eventCustomers = _eventCustomerRepository.GetEventCustomersforPatientSchedule(1, 20, filter, out totalRecords);

            Assert.IsNotNull(eventCustomers);
            Assert.IsNotEmpty(eventCustomers.ToList());
        }
 public ActionResult CustomerSchedule(CustomerScheduleModelFilter filter = null)
 {
     return(CreateExportQueue(filter, ExportableReportType.CustomerSchedule, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId));
 }