public ActionResult CallQueueCustomersCompleted(string id, CallQueueCustomersReportModelListModel model) { if (id == null) { return(Content("Model can't be null.")); } if (model == null || model.Collection.IsNullOrEmpty()) { return(Content("Model can't be null.")); } RemoveProcess(id); var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <CallQueueCustomersReportModel>(); var fileName = "CallQueueCustomers_" + model.HealthPlanName.Replace(" ", string.Empty) + "_" + model.CallQueueName.Replace(" ", string.Empty) + "_" + (model.Filter.EventId > 0 ? model.Filter.EventId + "_" : "") + id + ".csv"; var message = WriteCsv(fileName, exporter, model.Collection, RequestSubcriberChannelNames.CallQueueCustomersReportQueue, RequestSubcriberChannelNames.CallQueueCustomersReportChannel); return(Content(message)); }
public ListModelBase <CallQueueCustomersReportModel, OutboundCallQueueFilter> GetCallQueueCustomers(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords) { var callQueueFilter = filter as OutboundCallQueueFilter; callQueueFilter = callQueueFilter ?? new OutboundCallQueueFilter(); if (!callQueueFilter.CustomTags.IsNullOrEmpty()) { callQueueFilter.CustomCorporateTag = string.Join(",", callQueueFilter.CustomTags); } var criteria = _callQueueCriteriaRepository.GetById(callQueueFilter.CriteriaId); var callQueueId = callQueueFilter.CallQueueId; callQueueFilter.CallQueueId = criteria.CallQueueId; callQueueFilter.GmsAccountIds = _settings.GmsAccountIds; //callQueueFilter.NumberOfDays = _settings.CustomerReturnInCallQueue; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(callQueueFilter); var callQueue = _callQueueRepository.GetById(callQueueFilter.CallQueueId); var callqueueCustomersList = new List <CallQueueCustomer>(); totalRecords = 0; if (criteria.IsQueueGenerated) { if (callQueue.Category == HealthPlanCallQueueCategory.CallRound) { var customersInQueueList = _callQueueCustomerRepository.GetOutboundCallRoundCallQueue(callQueueFilter, pageNumber, pageSize, callQueue, callQueueFilter.CriteriaId, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } else if (callQueue.Category == HealthPlanCallQueueCategory.FillEventsHealthPlan) { var customersInQueueList = _callQueueCustomerRepository.GetCallQueueCustomerForHealthPlanFillEvents(callQueueFilter, pageNumber, pageSize, callQueueFilter.CriteriaId, callQueue, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } else if (callQueue.Category == HealthPlanCallQueueCategory.LanguageBarrier) { var customersInQueueList = _callQueueCustomerRepository.GetLanguageBarrierCallQueueCustomer(callQueueFilter, pageNumber, pageSize, callQueueFilter.CriteriaId, callQueue, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } else if (callQueue.Category == HealthPlanCallQueueCategory.UncontactedCustomers) { var customersInQueueList = _callQueueCustomerRepository.GetUncontactedCallQueueCustomers(callQueueFilter, pageNumber, pageSize, callQueueFilter.CriteriaId, _settings.NeverBeenCalledInDays, _settings.NoPastAppointmentInDaysUncontactedCustomers, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } else if (callQueue.Category == HealthPlanCallQueueCategory.NoShows) { var customersInQueueList = _callQueueCustomerRepository.GetNoShowCallQueueCustomer(callQueueFilter, pageNumber, pageSize, callQueueFilter.CriteriaId, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } else if (callQueue.Category == HealthPlanCallQueueCategory.MailRound) { var customersInQueueList = _callQueueCustomerRepository.GetMailRoundCallqueueCustomer(callQueueFilter, pageNumber, pageSize, callQueueFilter.CriteriaId, callQueue, out totalRecords); callqueueCustomersList = customersInQueueList == null ? new List <CallQueueCustomer>() : customersInQueueList.ToList(); } } var organization = _organizationRepository.GetOrganizationbyId(callQueueFilter.HealthPlanId); var rejectedCustomersStats = _excludedCustomerRepository.GetExcludedCustomers(callQueueFilter, callQueue); CallQueueCustomersReportModelListModel model = null; var criteriaModel = _healthPlanCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(callQueueFilter.CallQueueId, callQueueFilter.HealthPlanId, null, callQueueFilter.CampaignId.HasValue ? callQueueFilter.CampaignId.Value : 0, callQueueFilter.CriteriaId); callQueueFilter.CallQueueId = callQueueId; if (!callqueueCustomersList.IsNullOrEmpty()) { var customerIds = callqueueCustomersList.Select(x => x.CustomerId.Value); var customers = _customerRepository.GetCustomers(customerIds.ToArray()); var corporateAccount = ((IUniqueItemRepository <CorporateAccount>)_corporateAccountRepository).GetById(callQueueFilter.HealthPlanId); var corporateCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); model = _callQueueCustomerReportFactory.GetCallQueueCustomersList(callqueueCustomersList, customers, corporateCustomTags, corporateAccount, criteria.IsQueueGenerated, criteriaModel); } model = model ?? new CallQueueCustomersReportModelListModel(); model.CallQueueCriteria = criteriaModel; model.IsQueueGenerated = criteria.IsQueueGenerated; model.RejectedCustomersStats = rejectedCustomersStats ?? new CallQueueCustomersStatsViewModel(); model.HealthPlanName = organization.Name; model.CallQueueCategory = callQueue.Category; model.CallQueueName = callQueue.Name; model.Filter = callQueueFilter; return(model); }