public ListModelBase <GmsExcludedCustomerViewModel, OutboundCallQueueFilter> GetExcludedCustomers(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords) { var outboundCallQueueFilter = filter as OutboundCallQueueFilter ?? new OutboundCallQueueFilter(); var organization = _organizationRepository.GetOrganizationbyId(outboundCallQueueFilter.HealthPlanId); CallQueue callQueue = null; var criteria = _healthPlanCallQueueCriteriaRepository.GetById(outboundCallQueueFilter.CriteriaId); callQueue = _callQueueRepository.GetById(outboundCallQueueFilter.CallQueueId > 0 ? outboundCallQueueFilter.CallQueueId : criteria.CallQueueId); outboundCallQueueFilter.CallQueueId = callQueue.Id; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(outboundCallQueueFilter); var excludedCustomers = _gmsExcludedCustomerRepository.GetExcludedCallQueueCustomers(pageNumber, pageSize, outboundCallQueueFilter, callQueue, outboundCallQueueFilter.SuppressionType, out totalRecords); var model = new ExcludedCustomerListModel { Filter = outboundCallQueueFilter }; var customerIds = excludedCustomers.Where(x => x.CustomerId.HasValue).Select(x => x.CustomerId.Value).ToArray(); if (!customerIds.IsNullOrEmpty()) { var customers = _customerRepository.GetCustomers(customerIds); var customTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); model.Collection = Create(excludedCustomers, customers, customTags, organization); return(model); } model.Collection = Create(excludedCustomers, null, null, organization); return(model); }
public HealthPlanCallQueueCriteria GetSystemGeneratedCallQueueCriteria(long callQueueId, long healthPlanId, long?organizationUserRoleId, long campaignId, long?criterialId = null) { var callQueue = _callQueueRepository.GetById(callQueueId); HealthPlanCallQueueCriteria criteria = null; if (callQueue.Category == HealthPlanCallQueueCategory.LanguageBarrier) { criteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueue(callQueueId, healthPlanId); } else { criteria = criterialId.HasValue ? _healthPlanCallQueueCriteriaRepository.GetById(criterialId.Value) : _healthPlanCallQueueCriteriaRepository.GetQueueCriteria(callQueueId, organizationUserRoleId, healthPlanId, DateTime.Today); } return(criteria); }
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); }
public FillEventCallQueueModel GetEventBasicInfoForCallQueueReport(FillEventsCallQueueFilter filter, int pageSize, out int totalRecords) { var criteria = _healthPlanCallQueueCriteriaRepository.GetById(filter.CriteriaId); if (criteria != null && criteria.IsQueueGenerated == false) { totalRecords = 0; return(new FillEventCallQueueModel { Filter = filter, IsQueueGenerated = false, CallQueueCriteria = criteria }); } var callQueueId = filter.CallQueueId; filter.CallQueueId = criteria.CallQueueId; var events = _eventRepository.GetHealthPlanEventsForCallQueue(filter, criteria.Id); if (events == null || !events.Any()) { totalRecords = 0; return(null); } var endDate = DateTime.Today.AddDays(criteria.NoOfDays); events = events.Where(x => x.EventDate.Date <= endDate.Date); events = _fillEventsCallQueueHelper.GetAllTheEventFilledUnderPecentage(events, criteria.Percentage); var outboundCallQueueFilter = new OutboundCallQueueFilter { CallQueueId = criteria.CallQueueId, CriteriaId = criteria.Id, HealthPlanId = criteria.HealthPlanId ?? 0, Radius = 25, GmsAccountIds = _settings.GmsAccountIds }; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(outboundCallQueueFilter); var eventIdsWithCustomers = _callQueueCustomerRepository.GetHealthPlanEventsForCriteria(outboundCallQueueFilter); events = events.Where(x => (!eventIdsWithCustomers.IsNullOrEmpty() && eventIdsWithCustomers.Contains(x.Id))); totalRecords = events.Count(); events = events.OrderBy(ev => ev.EventDate).Skip((filter.PageNumber - 1) * pageSize).Take(pageSize); filter.CallQueueId = callQueueId; var model = _eventCallQueueHelper.EventBasicInfoListForCallQueue(events); if (model == null || model.Events.IsNullOrEmpty()) { return new FillEventCallQueueModel { Events = null, Filter = filter, IsQueueGenerated = true, CallQueueCriteria = criteria } } ; return(new FillEventCallQueueModel { Events = model.Events, Filter = filter, IsQueueGenerated = true, CallQueueCriteria = criteria }); } }