Exemple #1
0
        public void PollForCallQueue()
        {
            try
            {
                _logger.Info("Starting single call queue customer for Upsell");
                var callQueue = _callQueueRepository.GetCallQueueByCategory(CallQueueCategory.Upsell);
                var criterias = _systemGeneratedCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteriaNotGenerated(callQueue.Id);
                foreach (var criteria in criterias)
                {
                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                    var callQueueCustomers = _upsellCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.Amount, criteria.NoOfDays);
                    if (callQueueCustomers != null && callQueueCustomers.Any())
                    {
                        _logger.Info(string.Format("{0} single call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                        _logger.Info(string.Format("{0} single call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                    }
                    else
                    {
                        _logger.Info(string.Format("No single call queue customer found for {0}  for Agent Id : {1}", callQueue.Category, criteria.AssignedToOrgRoleUserId));
                    }

                    criteria.IsQueueGenerated       = true;
                    criteria.LastQueueGeneratedDate = DateTime.Now;
                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                }
                callQueue.IsQueueGenerated       = true;
                callQueue.LastQueueGeneratedDate = DateTime.Now;
                _callQueueRepository.Save(callQueue);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error while pulling single Upsell Event call queue. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }
Exemple #2
0
        public void GenerateUpsellCallqueue_Tester()
        {
            var upsellId  = 140;
            var criterias = _systemGeneratedCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(upsellId);

            criterias = criterias.Where(x => x.IsQueueGenerated == false);
            foreach (var criteria in criterias)
            {
                _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                var callQueueCustomers = _upsellCallQueueService.GetCallQueueCustomers(upsellId, criteria.Amount, criteria.NoOfDays);
                if (callQueueCustomers != null && callQueueCustomers.Any())
                {
                    _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                }

                criteria.IsQueueGenerated       = true;
                criteria.LastQueueGeneratedDate = DateTime.Now;
                _systemGeneratedCallQueueCriteriaService.Save(criteria);
            }
        }
        public void PollForCallQueue()
        {
            try
            {
                var callQueues = _callQueueRepository.GetAll(false);
                if (callQueues != null && callQueues.Any())
                {
                    foreach (var callQueue in callQueues)
                    {
                        var criterias = _systemGeneratedCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(callQueue.Id);
                        criterias = criterias.Where(x => x.IsQueueGenerated);
                        try
                        {
                            IEnumerable <CallQueueCustomer> callQueueCustomers;
                            switch (callQueue.Category)
                            {
                            case CallQueueCategory.EasiestToConvertProspect:
                                callQueueCustomers = _easiestToConvertCallQueueService.GetCallQueueCustomers(callQueue.Id, callQueue.LastQueueGeneratedDate);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.Annual:
                                callQueueCustomers = _annualCallQueueService.GetCallQueueCustomers(callQueue.Id);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.CallBack:
                                callQueueCustomers = _callBackCallQueueService.GetCallQueueCustomers(callQueue.Id, callQueue.LastQueueGeneratedDate);
                                if (callQueueCustomers != null && callQueueCustomers.Any())
                                {
                                    _logger.Info(string.Format("{0} call queue customer found for {1}", callQueueCustomers.Count(), callQueue.Category));
                                    _callQueueCustomerHelper.SaveCallQueueCustomerForCallBack(callQueueCustomers);
                                    _logger.Info(string.Format("{0} call queue customer saved for {1}", callQueueCustomers.Count(), callQueue.Category));
                                }
                                else
                                {
                                    _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                }
                                break;

                            case CallQueueCategory.FillEvents:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _fillEventsCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }
                                break;

                            case CallQueueCategory.Upsell:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _upsellCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.Amount, criteria.NoOfDays);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }

                                break;

                            case CallQueueCategory.Confirmation:
                                foreach (var criteria in criterias)
                                {
                                    _systemGeneratedCallQueueAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                                    callQueueCustomers = _confirmationCallQueueService.GetCallQueueCustomers(callQueue.Id, criteria.NoOfDays);
                                    if (callQueueCustomers != null && callQueueCustomers.Any())
                                    {
                                        _logger.Info(string.Format("{0} call queue customer found for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                        _callQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(callQueueCustomers, criteria.Id);
                                        _logger.Info(string.Format("{0} call queue customer saved for {1} for Agent Id : {2}", callQueueCustomers.Count(), callQueue.Category, criteria.AssignedToOrgRoleUserId));
                                    }
                                    else
                                    {
                                        _logger.Info(string.Format("No call queue customer found for {0}", callQueue.Category));
                                    }

                                    criteria.IsQueueGenerated       = true;
                                    criteria.LastQueueGeneratedDate = DateTime.Now;
                                    _systemGeneratedCallQueueCriteriaService.Save(criteria);
                                }
                                break;
                            }

                            callQueue.IsQueueGenerated       = true;
                            callQueue.LastQueueGeneratedDate = DateTime.Now;
                            _callQueueRepository.Save(callQueue);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error(string.Format("Error while creating {0} call queue. Message {1} \n Stack Trace {2}", callQueue.Category, ex.Message, ex.StackTrace));
                        }
                    }
                }
                else
                {
                    _logger.Info("No System generated call queue exist.");
                }
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error while pulling System generated call queue. Message {0} \n Stack Trace {1}", ex.Message, ex.StackTrace));
            }
        }