Ejemplo n.º 1
0
        public string ExcludedCusomerReportExport(OutboundCallQueueFilter filter, long userId)
        {
            var dataGen  = new ExportableDataGenerator <GmsExcludedCustomerViewModel, OutboundCallQueueFilter>(_excludedCustomerService.GetExcludedCustomers, Logger);
            var model    = dataGen.GetData(filter);
            var exporter = ExportableDataGeneratorProcessManager <ViewModelBase, ModelFilterBase> .GetCsvExporter <GmsExcludedCustomerViewModel>();

            return(WriteCsv(GetExportableFileName("ExcludedCustomerReport"), exporter, model.Collection, userId));
        }
Ejemplo n.º 2
0
        public StartOutBoundCallViewModel GetAvailableCustomer([FromBody] OutboundCallQueueFilter filter)
        {
            var agentOrgRoleUserId  = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
            var agentOrganizationId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationId;

            filter.AgentOrganizationRoleUserId = agentOrgRoleUserId;
            filter.AgentOrganizationId         = agentOrganizationId;

            return(_callQueueCustomerDetailService.GetCustomerContactViewModel(filter));
        }
Ejemplo n.º 3
0
        public ActionResult CallQueueEstimatedCustomer(OutboundCallQueueFilter filter, int pageNumber = 1)
        {
            filter = filter ?? new OutboundCallQueueFilter();
            _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
            var model = _callQueueCustomerRepository.GetCallQueueEstimatedNumbers(filter);

            model.CallQueueCriteria = _healthPlanCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(filter.CallQueueId, filter.HealthPlanId, null, filter.CampaignId.HasValue ? filter.CampaignId.Value : 0, filter.CriteriaId);

            return(View(model));
        }
        public StartOutBoundCallViewModel GetCustomerContactViewModel(OutboundCallQueueFilter filter)
        {
            StartOutBoundCallViewModel customerContactViewModel = null;

            //var isAllowed = _callQueueCriteriaRepository.CheckForHealthplanRestriction(filter.AgentOrganizationId, filter.HealthPlanId);
            //if (!isAllowed)
            //{
            //    return new StartOutBoundCallViewModel
            //    {
            //        NoMoreCustomerInList = true
            //    };
            //}

            var iscriteriaAssignmentChanged = _callQueueCriteriaRepository.CheckForCriteriaAssignmentChange(filter.CriteriaId, filter.AgentOrganizationRoleUserId,
                                                                                                            filter.AgentOrganizationId, filter.HealthPlanId);

            if (iscriteriaAssignmentChanged)
            {
                return(new StartOutBoundCallViewModel
                {
                    AssignmentChanged = true
                });
            }

            var callQueue = _callQueueRepository.GetById(filter.CallQueueId);

            _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
            var index = 1;

            _logger.Info("fetching customer for agent " + _sessionContext.UserSession.UserName);
            do
            {
                _logger.Info(string.Format("Call Queue Customer loop number {0} for agent {1}", index++, _sessionContext.UserSession.UserName));

                _logger.Info("fetching next customers");
                customerContactViewModel = GetStartOutboundCallViewModel(filter, callQueue);
                if (customerContactViewModel != null && customerContactViewModel.NoMoreCustomerInList)
                {
                    _logger.Info("queue completed no customer found");
                    break;
                }

                Thread.Sleep(100);
            } while (customerContactViewModel == null && index < 3);

            if (customerContactViewModel == null)
            {
                customerContactViewModel = new StartOutBoundCallViewModel
                {
                    TryAgain = true
                };
            }

            return(customerContactViewModel);
        }
Ejemplo n.º 5
0
        public OutboundCallQueueListModel GetnOutboundZipRadiusCallQueueListModel(OutboundCallQueueFilter filter, CallQueue callQueue, int pageSize, long criteriaId, out int totalRecords)
        {
            var callQueueCustomers = _callQueueCustomerRepository.GetZipRadiusCallQueueCustomer(filter, filter.PageNumber, pageSize, criteriaId, out totalRecords);

            if (callQueueCustomers.IsNullOrEmpty())
            {
                return(new OutboundCallQueueListModel {
                    IsQueueGenerated = true
                });
            }

            return(OutboundCallQueueListModel(callQueueCustomers, filter.CustomCorporateTag));
        }
Ejemplo n.º 6
0
        public OutboundCallQueueListModel GetOutboundCallQueue([FromUri] OutboundCallQueueFilter filter)
        {
            int  totalRecords;
            var  callQueue  = _callQueueRepository.GetById(filter.CallQueueId);
            var  criteria   = _systemGeneratedCallQueueCritairaService.GetSystemGeneratedCallQueueCriteria(filter.CallQueueId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
            long criteriaId = criteria != null ? criteria.Id : 0;
            OutboundCallQueueListModel model = null;

            if (callQueue.Category == CallQueueCategory.Upsell || callQueue.Category == CallQueueCategory.Confirmation)
            {
                if (criteria != null && criteria.IsQueueGenerated == false)
                {
                    model = new OutboundCallQueueListModel()
                    {
                        IsQueueGenerated = false
                    };
                    totalRecords = 0;
                }
                else
                {
                    model = _outboundCallQueueService.GetOutboundCallQueueUpsellAndConfirmation(filter, callQueue, PageSize, criteriaId, out totalRecords) ??
                            new OutboundCallQueueListModel()
                    {
                        IsQueueGenerated = true
                    };
                }
            }
            else
            {
                if (criteria != null && criteria.IsQueueGenerated == false)
                {
                    model = new OutboundCallQueueListModel()
                    {
                        IsQueueGenerated = false
                    };
                    totalRecords = 0;
                }
                else
                {
                    model = _outboundCallQueueService.GetOutboundCallQueueListModel(filter, callQueue, PageSize, criteriaId, out totalRecords) ?? new OutboundCallQueueListModel()
                    {
                        IsQueueGenerated = true
                    };
                }
            }

            model.PagingModel = new PagingModel(filter.PageNumber, PageSize, totalRecords, null);

            return(model);
        }
Ejemplo n.º 7
0
        public void GetAccountCallQueueSettingForCallQueue(OutboundCallQueueFilter filter)
        {
            filter.NumberOfDays = filter.NumberOfDaysForOthers = filter.NumberOfDaysForLeftVoiceMail = _settings.CustomerReturnInCallQueue;
            filter.NumberOfDaysForRefusedCustomer = _settings.RefusedCustomerReturnInCallQueue;

            if (filter.HealthPlanId > 0 && filter.CallQueueId > 0)
            {
                var accountCallQueueSettings = _accountCallQueueSettingRepository.GetByAccountIdAndCallQueueId(filter.HealthPlanId, filter.CallQueueId);

                var callQueueSetting = accountCallQueueSettings.FirstOrDefault(x => x.SuppressionTypeId == (int)CallQueueSuppressionType.Others);
                if (callQueueSetting != null && callQueueSetting.NoOfDays > 0)
                {
                    filter.NumberOfDaysForOthers = callQueueSetting.NoOfDays;
                }

                callQueueSetting = accountCallQueueSettings.FirstOrDefault(x => x.SuppressionTypeId == (int)CallQueueSuppressionType.LeftVoiceMail);
                if (callQueueSetting != null && callQueueSetting.NoOfDays > 0)
                {
                    filter.NumberOfDaysForLeftVoiceMail = callQueueSetting.NoOfDays;
                }
                else
                {
                    filter.NumberOfDaysForLeftVoiceMail = filter.NumberOfDaysForOthers;
                }

                callQueueSetting = accountCallQueueSettings.FirstOrDefault(x => x.SuppressionTypeId == (int)CallQueueSuppressionType.RefuseCustomer);
                if (callQueueSetting != null && callQueueSetting.NoOfDays > 0)
                {
                    filter.NumberOfDaysForRefusedCustomer = callQueueSetting.NoOfDays;
                }

                var account = ((IUniqueItemRepository <CorporateAccount>)_corporateAccountRepository).GetById(filter.HealthPlanId);
                filter.IsMaxAttemptPerHealthPlan = account.IsMaxAttemptPerHealthPlan;
                if (account.IsMaxAttemptPerHealthPlan)
                {
                    filter.MaxAttempt = account.MaxAttempt.HasValue ? account.MaxAttempt.Value : 0;
                }
                else
                {
                    callQueueSetting = accountCallQueueSettings.FirstOrDefault(x => x.SuppressionTypeId == (long)CallQueueSuppressionType.MaxAttempts);
                    if (callQueueSetting != null && callQueueSetting.NoOfDays > 0)
                    {
                        filter.MaxAttempt = callQueueSetting.NoOfDays;
                    }
                }

                filter.DaysForAppointmentConfirmation       = account.EventConfirmationBeforeDays.HasValue ? account.EventConfirmationBeforeDays.Value : 0;
                filter.ConfirmationBeforeAppointmentMinutes = account.ConfirmationBeforeAppointmentMinutes.HasValue ? account.ConfirmationBeforeAppointmentMinutes.Value : 0;
            }
        }
Ejemplo n.º 8
0
        public string CallQueueCustomersReportExport(OutboundCallQueueFilter filter, long userId)
        {
            var dataGen = new ExportableDataGenerator <CallQueueCustomersReportModel, OutboundCallQueueFilter>(_callQueueCustomerReportService.GetCallQueueCustomers, Logger);

            var model     = dataGen.GetData(filter);
            var listModel = model as CallQueueCustomersReportModelListModel;

            listModel = listModel ?? new CallQueueCustomersReportModelListModel();

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

            var fileName = "CallQueueCustomers_" + listModel.HealthPlanName + "_" + listModel.CallQueueName + (model.Filter.EventId > 0 ? "_" + listModel.Filter.EventId : "");

            return(WriteCsv(GetExportableFileName(fileName), exporter, model.Collection, userId));
        }
Ejemplo n.º 9
0
        public void ExcludedCustomersAsync(string id = null, OutboundCallQueueFilter filter = null)
        {
            if (id == null)
            {
                return;
            }

            AsyncManager.OutstandingOperations.Increment();
            var dataGen = new ExportableDataGenerator <GmsExcludedCustomerViewModel, OutboundCallQueueFilter>(_gmsExcludedCustomerService.GetExcludedCustomers);

            var processmanager = new ExportableDataGeneratorProcessManager <GmsExcludedCustomerViewModel, OutboundCallQueueFilter>();

            processmanager.Add(id, dataGen);

            GetNewProcessStarted(filter, dataGen, id);
        }
Ejemplo n.º 10
0
        public IEnumerable <GmsExcludedCustomerViewModel> GetGmsExcludedCustomers(OutboundCallQueueFilter filter, CallQueue callQueue)
        {
            var suppressionTypes = SuppressionFilterType.MaxAttempt.GetNameValuePairs();

            var organization = _organizationRepository.GetOrganizationbyId(filter.HealthPlanId);

            _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
            var collection = new List <GmsExcludedCustomerViewModel>();

            foreach (var suppressionType in suppressionTypes)
            {
                int totalRecords             = 0;
                var suppressionTypeCustomers = new List <GmsExcludedCustomerViewModel>();
                var pageNumber = 1;

                while (true)
                {
                    var excludedCustomers = _gmsExcludedCustomerRepository.GetGmsExcludedCallQueueCustomers(pageNumber, PageSize, filter, callQueue,
                                                                                                            (SuppressionFilterType)suppressionType.FirstValue, out totalRecords);

                    if (excludedCustomers.IsNullOrEmpty())
                    {
                        break;
                    }

                    var customerIds = excludedCustomers.Where(x => x.CustomerId.HasValue).Select(x => x.CustomerId.Value).ToArray();

                    var customers  = _customerRepository.GetCustomers(customerIds);
                    var customTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds);

                    suppressionTypeCustomers.AddRange(Create(excludedCustomers, customers, customTags, organization));

                    if ((pageNumber * PageSize) >= totalRecords)
                    {
                        break;
                    }

                    pageNumber++;
                }

                var distinctCustomers = suppressionTypeCustomers.Where(x => !collection.Select(c => c.CustomerId).Contains(x.CustomerId));
                collection.AddRange(distinctCustomers);
            }

            return(collection);
        }
Ejemplo n.º 11
0
        public EventBasicInfoListModel GetEventBasicInfoForCallQueue(FillEventsCallQueueFilter filter, int pageSize, out int totalRecords)
        {
            var criteria = _healthPlanCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(filter.CallQueueId, filter.HealthPlanId, filter.AssignedToOrgRoleUserId, 0, filter.CriteriaId);

            if (criteria != null && criteria.IsQueueGenerated == false)
            {
                throw new Exception("Please wait for 10 minutes(max) after you have changed the criteria so that the queue is regenerated.");
            }
            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);

            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)));

            events       = _fillEventsCallQueueHelper.GetAllTheEventFilledUnderPecentage(events, criteria.Percentage);
            totalRecords = events.Count();
            events       = events.OrderBy(ev => ev.EventDate).Skip((filter.PageNumber - 1) * pageSize).Take(pageSize);

            var eventList = _eventCallQueueHelper.EventBasicInfoListForCallQueue(events);

            return(eventList);
        }
Ejemplo n.º 12
0
        public OutboundCallQueueListModel GetOutboundCallQueueUpsellAndConfirmation(OutboundCallQueueFilter filter, CallQueue callQueue, int pageSize, long criteriaId, out int totalRecords)
        {
            var callQueueCustomers = _callQueueCustomerRepository.GetCallQueueCustomerForUpsellAndConfirmation(filter, filter.PageNumber, pageSize, callQueue, criteriaId, out totalRecords);

            if (callQueueCustomers.IsNullOrEmpty())
            {
                return(null);
            }

            var eventIds    = callQueueCustomers.Where(x => x.EventId.HasValue).Select(x => x.EventId.Value).Distinct();
            var customerIds = callQueueCustomers.Where(cqc => cqc.CustomerId.HasValue && cqc.CustomerId.Value > 0).Select(cqc => cqc.CustomerId.Value).Distinct().ToArray();

            var eventCustomers = _eventCustomerRepository.GetByEventIds(eventIds);

            eventCustomers = eventCustomers.Where(ec => customerIds.Contains(ec.CustomerId));

            var orgRoleUserIds = eventCustomers.Where(ec => ec.DataRecorderMetaData != null && ec.DataRecorderMetaData.DataRecorderCreator != null).Select(ec => ec.DataRecorderMetaData.DataRecorderCreator.Id).ToList();

            var registeredbyAgent = _organizationRoleUserRepository.GetOrganizationRoleUsers(orgRoleUserIds);

            var roles = _roleRepository.GetAll();

            // var registeredbyAgentNameIdPair = _organizationRoleUserRepository.GetNameIdPairofUsers(orgRoleUserIds.ToArray()).ToArray();

            var appointment = _appointmentRepository.GetByIds(eventCustomers.Where(ec => ec.AppointmentId.HasValue).Select(ec => ec.AppointmentId.Value));

            var events = _eventRepository.GetEventswithPodbyIds(eventIds).ToList();
            var hosts  = _hostRepository.GetEventHosts(eventIds).ToList();
            var pods   = _podRepository.GetPodsForEvents(eventIds);

            IEnumerable <Customer> customers = _customerRepository.GetCustomers(customerIds);

            var callQueueCustomerCalls = _callCenterCallRepository.GetCallForCallQueueCustomerList(customerIds, null);
            IEnumerable <CallCenterNotes> callCenterNotes = null;

            if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any())
            {
                callCenterNotes = _callCenterNotesRepository.GetByCallIds(callQueueCustomerCalls.Select(s => s.CallId));
            }

            return(_outboundCallQueueListModelFactory.CallQueueCustomersForUpsellAndConfimration(callQueueCustomers, customers, callQueueCustomerCalls, callCenterNotes, events, hosts, pods, appointment, eventCustomers, registeredbyAgent, roles));
        }
Ejemplo n.º 13
0
        public OutboundCallQueueListModel GetOutboundCallQueueListModel(OutboundCallQueueFilter filter, CallQueue callQueue, int pageSize, long criteriaId, out int totalRecords)
        {
            IEnumerable <CallQueueCustomer> callQueueCustomers;

            if (callQueue.Category == CallQueueCategory.FillEvents)
            {
                callQueueCustomers = _callQueueCustomerRepository.GetCallQueueCustomerForFillEvents(filter, filter.PageNumber, pageSize, criteriaId, out totalRecords);
            }
            else
            {
                callQueueCustomers = _callQueueCustomerRepository.GetCallQueueCustomerForZipCode(filter, filter.PageNumber, pageSize, out totalRecords);
            }


            if (callQueueCustomers.IsNullOrEmpty())
            {
                return(null);
            }

            var customerIds = callQueueCustomers.Where(cqc => cqc.CustomerId.HasValue && cqc.CustomerId.Value > 0).Select(cqc => cqc.CustomerId.Value).ToArray();
            IEnumerable <Customer> customers = null;

            if (customerIds.Any())
            {
                customerIds = customerIds.Distinct().ToArray();
                customers   = _customerRepository.GetCustomers(customerIds);
            }

            var prospectCustomerIds = callQueueCustomers.Where(cqc => cqc.ProspectCustomerId.HasValue && cqc.ProspectCustomerId.Value > 0).Select(cqc => cqc.ProspectCustomerId.Value).Distinct().ToArray();//&& !cqc.CustomerId.HasValue

            var prospectCustomers = _prospectCustomerRepository.GetProspectCustomers(prospectCustomerIds);

            var callQueueCustomerCalls = _callCenterCallRepository.GetCallForCallQueueCustomerList(customerIds, prospectCustomerIds);
            IEnumerable <CallCenterNotes> callCenterNotes = null;

            if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any())
            {
                callCenterNotes = _callCenterNotesRepository.GetByCallIds(callQueueCustomerCalls.Select(s => s.CallId));
            }

            return(_outboundCallQueueListModelFactory.SystemGeneratedCallQueueCustomers(callQueueCustomers, customers, prospectCustomers, callQueueCustomerCalls, callCenterNotes, null, null, null));
        }
Ejemplo n.º 14
0
        private List <MailRoundCustomersReportViewModel> GetCustomersForMatrixReport(long healthPlanId, CallQueue callQueue)
        {
            var list = new List <MailRoundCustomersReportViewModel>();

            if (callQueue == null)
            {
                return(list);
            }

            var       pageNumber = 1;
            const int pageSize   = 100;

            var filter = new OutboundCallQueueFilter();

            filter.HealthPlanId  = healthPlanId;
            filter.CallQueueId   = callQueue.Id;
            filter.GmsAccountIds = _settings.GmsAccountIds;

            _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);

            while (true)
            {
                int totalRecords;
                var model = _callQueueCustomerReportService.GetCustomersForMatrixReport(pageNumber, pageSize, filter, callQueue, out totalRecords);
                if (model == null || model.Collection == null || !model.Collection.Any())
                {
                    break;
                }

                list.AddRange(model.Collection);
                _logger.Info(String.Format("\n\nPageNumber:{0} TotalRecords: {1},  Current Length: {2}", pageNumber, totalRecords, list.Count));

                pageNumber++;

                if (list.Count >= totalRecords)
                {
                    break;
                }
            }
            return(list);
        }
Ejemplo n.º 15
0
        public ActionResult CallQueueCustomers(OutboundCallQueueFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;

            filter = filter ?? new OutboundCallQueueFilter();

            var model = _callQueueCustomerReportService.GetCallQueueCustomers(pageNumber, _pageSize, filter, out totalRecords);

            model = model ?? new CallQueueCustomersReportModelListModel {
                RejectedCustomersStats = new CallQueueCustomersStatsViewModel()
            };
            model.Filter = filter;

            var currentAction        = ControllerContext.RouteData.Values["action"].ToString();
            var routeValueDictionary = GetRouteValueDictionaryForCallQueueCustomerReportModel(filter);

            Func <int, string> urlFunc = pn => Url.Action(currentAction, AddRouteValueDictionary(routeValueDictionary, pn));

            model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);
            return(View(model));
        }
Ejemplo n.º 16
0
        public ExcludedCustomerListModel SetHeaderData(OutboundCallQueueFilter filter, ExcludedCustomerListModel model)
        {
            var       organization = _organizationRepository.GetOrganizationbyId(filter.HealthPlanId);
            CallQueue callQueue    = null;
            var       criteria     = _healthPlanCallQueueCriteriaRepository.GetById(filter.CriteriaId);

            callQueue = _callQueueRepository.GetById(filter.CallQueueId > 0 ? filter.CallQueueId : criteria.CallQueueId);
            var criteriaName = string.Empty;

            if (filter.CampaignId.HasValue && filter.CampaignId.Value > 0)
            {
                var campagin = _campaignRepository.GetById(filter.CampaignId.Value);
                criteriaName = campagin.Name;
            }

            model.CallQueueType   = callQueue.Name;
            model.HealthPlanName  = organization.Name;
            model.SuppressionType = filter.SuppressionType.GetDescription();
            model.CriteriaName    = string.IsNullOrEmpty(criteria.CriteriaName) ? criteriaName : criteria.CriteriaName;

            return(model);
        }
Ejemplo n.º 17
0
        public ActionResult ExcludedCustomers(OutboundCallQueueFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;

            filter = filter ?? new OutboundCallQueueFilter();
            var model                = _gmsExcludedCustomerService.GetExcludedCustomers(pageNumber, _pageSize, filter, out totalRecords);
            var currentAction        = ControllerContext.RouteData.Values["action"].ToString();
            var routeValueDictionary = GetRouteValueDictionaryForCallQueueCustomerReportModel(filter);

            Func <int, string> urlFunc = pn => Url.Action(currentAction, AddRouteValueDictionary(routeValueDictionary, pn));

            var excludedCustomerListModel = new ExcludedCustomerListModel
            {
                Collection  = model.Collection,
                Filter      = model.Filter,
                PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc)
            };

            excludedCustomerListModel = _gmsExcludedCustomerService.SetHeaderData(filter, excludedCustomerListModel);

            return(View(excludedCustomerListModel));
        }
Ejemplo n.º 18
0
        public long CustomerCountForHealthPlanCriteria(HealthPlanCallQueueCriteria criteria, IEnumerable <CallQueue> callQueues, bool isForDashboard = false)
        {
            var  callQueueCategory         = callQueues.FirstOrDefault(x => x.Id == criteria.CallQueueId).Category;
            long totalCustomersForCriteria = 0;
            var  filter = new OutboundCallQueueFilter
            {
                CallQueueId   = criteria.CallQueueId,
                CriteriaId    = criteria.Id,
                HealthPlanId  = criteria.HealthPlanId ?? 0,
                GmsAccountIds = _settings.GmsAccountIds
                                //Radius = 25,
                                //ZipCode = criteria.ZipCode
            };

            if (callQueueCategory == HealthPlanCallQueueCategory.FillEventsHealthPlan)
            {
                _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
                totalCustomersForCriteria = _callQueueCustomerRepository.GetCallQueueCustomerCountForHealthPlanFillEvents(filter, isForDashboard);
            }
            else if (callQueueCategory == HealthPlanCallQueueCategory.MailRound)
            {
                filter.CampaignId = criteria.CampaignId;

                _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
                totalCustomersForCriteria = _callQueueCustomerRepository.GetMailRoundCallqueueCustomerCount(filter, isForDashboard);
            }
            else if (callQueueCategory == HealthPlanCallQueueCategory.LanguageBarrier)
            {
                _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
                totalCustomersForCriteria = _callQueueCustomerRepository.GetLanguageBarrierCallQueueCustomerCount(filter, isForDashboard);
            }
            else if (callQueueCategory == HealthPlanCallQueueCategory.AppointmentConfirmation)
            {
                _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);
                totalCustomersForCriteria = _callQueueCustomerRepository.GetConfirmationCallQueueCustomerCount(filter);
            }
            return(totalCustomersForCriteria);
        }
        public StartOutBoundCallViewModel GetStartOutboundCallViewModel(OutboundCallQueueFilter filter, CallQueue callQueue)
        {
            var callQueueCustomers = _callQueueCustomerContactService.GetSingleCustomerFromCallQueue(filter, PageSizeForContactCustomer, callQueue);

            if (callQueueCustomers.IsNullOrEmpty())
            {
                return(new StartOutBoundCallViewModel
                {
                    NoMoreCustomerInList = true
                });
            }
            _logger.Info("customers found in queue");

            long count = 1;

            foreach (var callQueueCustomer in callQueueCustomers)
            {
                _logger.Info("call queue customer " + callQueueCustomer.Id + " checking for locked ");
                _logger.Info(string.Format("Check for lock loop number {0} for agent {1}", count++, _sessionContext.UserSession.UserName));

                var callAttempt = SetCustomerCallQueueAttempt(callQueueCustomer);
                if (callAttempt != null)
                {
                    _logger.Info(" customer locked for agent " + _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                    return(new StartOutBoundCallViewModel
                    {
                        CallQueueCustomerId = callQueueCustomer.Id,
                        AttemptId = callAttempt.CallAttemptId
                    });
                }
            }

            _logger.Info("Batch completed no customer found.");

            return(null);
        }
        public ListModelBase <MailRoundCustomersReportViewModel, OutboundCallQueueFilter> GetCustomersForMatrixReport(int pageNumber, int pageSize, OutboundCallQueueFilter filter, CallQueue callQueue, out int totalRecords)
        {
            totalRecords = 0;
            MailRoundCustomersListModel model       = null;
            IEnumerable <long>          customerIds = null;

            if (callQueue.Category == HealthPlanCallQueueCategory.MailRound)
            {
                customerIds = _callQueueCustomerRepository.GetMailRoundCustomerIdsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords);
            }
            else if (callQueue.Category == HealthPlanCallQueueCategory.FillEventsHealthPlan)
            {
                customerIds = _callQueueCustomerRepository.GetFillEventCustomerIDsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords);
            }
            else if (callQueue.Category == HealthPlanCallQueueCategory.LanguageBarrier)
            {
                customerIds = _callQueueCustomerRepository.GetLanguageBarrierCustomerIDsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords);
            }

            if (!customerIds.IsNullOrEmpty())
            {
                var startOfYear = new DateTime(DateTime.Now.Year, 1, 1);
                var customers   = _customerRepository.GetCustomers(customerIds.ToArray());
                var directMails = _directMailRepository.GetByCustomerIds(customerIds, startOfYear);
                var callDetails = _callCenterCallRepository.GetCallsByCustomerIds(customerIds, fromDate: startOfYear, isOutbound: true);
                var customTags  = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds, startOfYear);

                model = _mailRoundCustomersReportFactory.Create(customers, callDetails, directMails, customTags);
            }

            model        = model ?? new MailRoundCustomersListModel();
            model.Filter = filter;

            return(model);
        }
Ejemplo n.º 21
0
 public ActionResult ExcludedCustomerReport(OutboundCallQueueFilter filter = null)
 {
     return(CreateExportQueue(filter, ExportableReportType.ExcludedCustomerReport, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId));
 }
Ejemplo n.º 22
0
        public OutboundCallQueueListModel GetnOutboundUncontactedCustomersCallQueueListModel(OutboundCallQueueFilter filter, CallQueue callQueue, int pageSize, long criteriaId, out int totalRecords)
        {
            var callQueueCustomers = _callQueueCustomerRepository.GetUncontactedCallQueueCustomers(filter, filter.PageNumber, pageSize, criteriaId, _settings.NeverBeenCalledInDays, _settings.NoPastAppointmentInDaysUncontactedCustomers, out totalRecords);

            if (callQueueCustomers.IsNullOrEmpty())
            {
                return(new OutboundCallQueueListModel {
                    IsQueueGenerated = true
                });
            }

            return(OutboundCallQueueListModel(callQueueCustomers, filter.CustomCorporateTag));
        }
        public void PollForReportGeneration()
        {
            var healthPlans = !_healthPlanIds.IsNullOrEmpty() ? _corporateAccountRepository.GetByIds(_healthPlanIds) : _corporateAccountRepository.GetAllHealthPlan();

            var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.MailRound);

            var collection = new List <GmsCallQueueCustomerViewModel>();

            foreach (var healthPlan in healthPlans)
            {
                if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount)
                {
                    break;
                }

                _logger.Info(string.Format("Getting call queue customers for Account ID : {0} and Tag : {1}", healthPlan.Id, healthPlan.Tag));

                var criterias = _healthPlanCallQueueCriteriaRepository.GetCriteriaByHealthPlanCallQueue(healthPlan.Id, HealthPlanCallQueueCategory.MailRound);

                if (!_settings.GmsCampaignIds.IsNullOrEmpty())
                {
                    criterias = _healthPlanCallQueueCriteriaRepository.GetByCampaignIds(_settings.GmsCampaignIds, healthPlan.Id);

                    _logger.Info(string.Format("Found {0} criterias for Campaign IDs : ", criterias.Count(), string.Join(",", _settings.GmsCampaignIds)));
                }

                foreach (var criteria in criterias)
                {
                    if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount)
                    {
                        break;
                    }

                    _logger.Info(string.Format("Criteria ID : {0}", criteria.Id));

                    try
                    {
                        var filter = new OutboundCallQueueFilter
                        {
                            CallQueueId             = callQueue.Id,
                            CriteriaId              = criteria.Id,
                            CampaignId              = criteria.CampaignId,
                            Tag                     = healthPlan.Tag,
                            HealthPlanId            = healthPlan.Id,
                            UseCustomTagExclusively = false
                        };

                        if (filter.HealthPlanId == _settings.OptumUtAccountId)
                        {
                            filter.CustomCorporateTag = _settings.OptumUtCustomTagsForGms;
                        }
                        else if (filter.HealthPlanId == 1083)
                        {
                            filter.CustomCorporateTag = "UHC-TX_GMS_2018_List-1";
                        }
                        else if (filter.HealthPlanId == 1066)
                        {
                            filter.CustomCorporateTag = "Excellus_GMS_2018_List-1";
                        }
                        else if (filter.HealthPlanId == 1061)
                        {
                            filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-1_GMS,Optum-NV_Assessments_2018_List-2_GMS,Optum-NV_Assessments_2018_List-3_GMS,Optum-NV_Mammo_2018_List-2_GMS";
                        }
                        else if (filter.HealthPlanId == 1111)
                        {
                            filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-4_GMS";
                        }
                        else if (filter.HealthPlanId == 1087)
                        {
                            filter.CustomCorporateTag = "UHC-AZ_Assessments_2018_List-1_GMS";
                        }
                        else if (filter.HealthPlanId == 1093)
                        {
                            filter.CustomCorporateTag = "UHC-CT_Assessments_2018_List-1_GMS";
                        }

                        _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter);

                        var dataGen = new ExportableDataGenerator <GmsCallQueueCustomerViewModel, OutboundCallQueueFilter>(_callQueueCustomerReportService.GetGmsCallQueueCustomersReport, _logger);

                        var model = dataGen.GetData(filter);

                        var distinctCustomers = model.Collection.Where(x => !collection.Select(c => c.CustomerId).Contains(x.CustomerId));

                        collection.AddRange(distinctCustomers);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error("Error getting call queue customers for Account ID : " + healthPlan.Id + " Criteria ID : " + criteria.Id);
                        _logger.Error(ex);
                    }
                }
            }

            if (!collection.Any())
            {
                _logger.Info("No records found.");
                return;
            }

            if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount)
            {
                collection = collection.Take(_settings.GmsMaxCustomerCount).ToList();
            }

            if (!Directory.Exists(_settings.GmsCustomerReportPath))
            {
                Directory.CreateDirectory(_settings.GmsCustomerReportPath);
            }

            var fileName = _settings.GmsCustomerReportPath + @"\" + string.Format("PatientList_{0}.csv", DateTime.Today.ToString("yyyyMMdd"));

            WriteCsv(collection, fileName);

            if (_settings.SendReportToGmsSftp)
            {
                _logger.Info("Sending Customer List to GMS sftp.");
                var sftpFolderReportDirectory = _settings.GmsSftpPath;
                var processFtp = new ProcessFtp(_logger, _settings.GmsSftpHost, _settings.GmsSftpUserName, _settings.GmsSftpPassword);

                processFtp.UploadSingleFile(fileName, sftpFolderReportDirectory, "");
                _logger.Info("Sent Customer List to GMS sftp.");
            }
            else
            {
                _logger.Info("Setting to send Customer list to sftp is OFF.");
            }
        }
        public void PollForReport()
        {
            if (_healthPlanIds.IsNullOrEmpty())
            {
                _logger.Info("No Health Plan IDs found.");
                return;
            }

            var healthPlans = _corporateAccountRepository.GetByIds(_healthPlanIds);

            var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.MailRound);

            var collection = new List <GmsExcludedCustomerViewModel>();

            foreach (var healthPlan in healthPlans)
            {
                _logger.Info("Getting excluded customers for Account ID : " + healthPlan.Id);

                var criterias = _healthPlanCallQueueCriteriaRepository.GetCriteriaForMailRoundGms(healthPlan.Id);

                if (!_settings.GmsCampaignIds.IsNullOrEmpty())
                {
                    criterias = _healthPlanCallQueueCriteriaRepository.GetByCampaignIds(_settings.GmsCampaignIds, healthPlan.Id);

                    _logger.Info(string.Format("Found {0} criterias for Campaign IDs : ", criterias.Count(), string.Join(",", _settings.GmsCampaignIds)));
                }

                foreach (var criteria in criterias)
                {
                    _logger.Info("Criteria ID : " + criteria.Id);

                    try
                    {
                        var filter = new OutboundCallQueueFilter
                        {
                            CallQueueId             = callQueue.Id,
                            CriteriaId              = criteria.Id,
                            CampaignId              = criteria.CampaignId,
                            Tag                     = healthPlan.Tag,
                            HealthPlanId            = healthPlan.Id,
                            UseCustomTagExclusively = false
                        };

                        if (filter.HealthPlanId == _settings.OptumUtAccountId)
                        {
                            filter.CustomCorporateTag = _settings.OptumUtCustomTagsForGms;
                        }
                        else if (filter.HealthPlanId == 1083)
                        {
                            filter.CustomCorporateTag = "UHC-TX_GMS_2018_List-1";
                        }
                        else if (filter.HealthPlanId == 1066)
                        {
                            filter.CustomCorporateTag = "Excellus_GMS_2018_List-1";
                        }
                        else if (filter.HealthPlanId == 1061)
                        {
                            filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-1_GMS,Optum-NV_Assessments_2018_List-2_GMS,Optum-NV_Assessments_2018_List-3_GMS,Optum-NV_Mammo_2018_List-2_GMS";
                        }
                        else if (filter.HealthPlanId == 1111)
                        {
                            filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-4_GMS";
                        }
                        else if (filter.HealthPlanId == 1087)
                        {
                            filter.CustomCorporateTag = "UHC-AZ_Assessments_2018_List-1_GMS";
                        }
                        else if (filter.HealthPlanId == 1093)
                        {
                            filter.CustomCorporateTag = "UHC-CT_Assessments_2018_List-1_GMS";
                        }

                        var excludedCustomerCollection = _gmsExcludedCustomerService.GetGmsExcludedCustomers(filter, callQueue);

                        var distinctCustomers = excludedCustomerCollection.Where(x => !collection.Select(c => c.CustomerId).Contains(x.CustomerId));

                        collection.AddRange(distinctCustomers);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error("Error getting excluded customers for Account ID : " + healthPlan.Id + " Criteria ID : " + criteria.Id);
                        _logger.Error(ex);
                    }
                }

                _logger.Info("Completed for Account ID : " + healthPlan.Id);
            }

            var excludedPath = _settings.GmsExcludeReportDownloadCustomerPath;

            if (DirectoryOperationsHelper.CreateDirectoryIfNotExist(excludedPath))
            {
                var fileName = Path.Combine(excludedPath, string.Format("ExcludedPatientList_{0}.csv", DateTime.Today.ToString("yyyyMMdd")));
                WriteCsv(collection, fileName);
            }
            else
            {
                _logger.Error("Folder can not be created");
            }
        }
Ejemplo n.º 25
0
        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
            });
        }
    }
Ejemplo n.º 26
0
        private RouteValueDictionary GetRouteValueDictionaryForCallQueueCustomerReportModel(OutboundCallQueueFilter filter)
        {
            var routeValueDictionary = new RouteValueDictionary
            {
                { "CriteriaId", filter.CriteriaId },
                { "CallQueueId", filter.CallQueueId },
                { "HealthPlanId", filter.HealthPlanId },
                { "EventId", filter.EventId },
                { "Radius", filter.Radius },
                { "ZipCode", filter.ZipCode },
                { "CustomerId", filter.CustomerId },
                { "CampaignId", filter.CampaignId },
                { "MemberId", filter.MemberId },
                { "DirectMailDate", filter.DirectMailDate },
                { "UseCustomTagExclusively", filter.UseCustomTagExclusively },
                { "SuppressionType", filter.SuppressionType }
            };

            if (filter.CustomTags != null)
            {
                var index = 0;
                foreach (var customtag in filter.CustomTags)
                {
                    routeValueDictionary.Add(string.Format("CustomTags[{0}]", index), customtag);
                    index++;
                }
            }

            return(routeValueDictionary);
        }