Ejemplo n.º 1
0
        public void SetReadAndUnderstoodNotes(long callAttemptId)
        {
            var callAttemptRecord = _customerCallQueueCallAttemptRepository.GetById(callAttemptId);

            callAttemptRecord.IsNotesReadAndUnderstood = true;
            _customerCallQueueCallAttemptRepository.Save(callAttemptRecord);
        }
Ejemplo n.º 2
0
        public void EndHealthPlanActiveCall(EndHealthPlanCallEditModel model, long orgRoleUserId)
        {
            var isCallQueueRequsted = false;
            var removeFromCallQueue = false;
            var callQueueCustomer   = _callQueueCustomerRepository.GetById(model.CallQueueCustomerId);

            //update call status in CustomerCallQueueCallAttempt Table
            if (model.IsSkipped && model.AttemptId > 0)
            {
                var attempt = _customerCallQueueCallAttemptRepository.GetById(model.AttemptId);
                attempt.IsCallSkipped = true;

                if (!string.IsNullOrEmpty(model.SkipCallNote))
                {
                    attempt.SkipCallNote = model.SkipCallNote;
                }
                callQueueCustomer.Status        = CallQueueStatus.Initial;
                callQueueCustomer.DateModified  = DateTime.Now;
                callQueueCustomer.CallDate      = DateTime.Now.AddDays(1);
                callQueueCustomer.ContactedDate = DateTime.Now;

                _customerCallQueueCallAttemptRepository.Save(attempt);
            }
            else if (model.CallId != 0)
            {
                Call callCenterCalll = null;
                if (model.CallId > 0)
                {
                    callCenterCalll = _callCenterCallRepository.GetById(model.CallId);
                    var tag = (ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.SelectedDisposition);
                    //  if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.IncorrectPhoneNumber)
                    if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.TalkedtoOtherPerson && tag == ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers)
                    {
                        removeFromCallQueue = true;
                    }
                }
                if (!string.IsNullOrEmpty(model.SelectedDisposition))
                {
                    var tag = (ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.SelectedDisposition);
                    if (tag == ProspectCustomerTag.CallBackLater)
                    {
                        isCallQueueRequsted = true;
                    }
                    else if (tag == ProspectCustomerTag.BookedAppointment || tag == ProspectCustomerTag.HomeVisitRequested || tag == ProspectCustomerTag.MobilityIssue ||
                             tag == ProspectCustomerTag.DoNotCall || tag == ProspectCustomerTag.Deceased || tag == ProspectCustomerTag.NoLongeronInsurancePlan ||
                             tag == ProspectCustomerTag.MobilityIssues_LeftMessageWithOther || tag == ProspectCustomerTag.DebilitatingDisease || tag == ProspectCustomerTag.InLongTermCareNursingHome)
                    {
                        removeFromCallQueue = true;
                    }

                    if (tag == ProspectCustomerTag.LanguageBarrier && callQueueCustomer.CustomerId.HasValue && callQueueCustomer.CustomerId.Value > 0)
                    {
                        _customerService.UpdateIsLanguageBarrier(callQueueCustomer.CustomerId.Value, true, orgRoleUserId);
                    }
                }

                _callQueueCustomerContactService.EndActiveCall(callQueueCustomer, model.CallId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue, model.CallOutcomeId, model.SkipCallNote);

                var customerId         = callQueueCustomer.CustomerId ?? 0;
                var prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0;

                if (prospectCustomerId == 0)
                {
                    var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId);
                    if (prospectCustomer != null)
                    {
                        prospectCustomerId = prospectCustomer.Id;
                    }
                }
                _callQueueCustomerRepository.UpdateOtherCustomerAttempt(model.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, model.CallOutcomeId);
            }
        }
Ejemplo n.º 3
0
        public bool EndHealthPlanActiveCall([FromBody] EndHealthPlanCallEditModel model)
        {
            var isCallQueueRequsted = false;
            var removeFromCallQueue = false;
            var callQueueCustomer   = _callQueueCustomerRepository.GetById(model.CallQueueCustomerId);

            if (model.IsSkipped && model.AttemptId > 0)
            {
                var attempt = _customerCallQueueCallAttemptRepository.GetById(model.AttemptId);
                attempt.IsCallSkipped = true;

                if (!string.IsNullOrEmpty(model.SkipCallNote))
                {
                    attempt.SkipCallNote = model.SkipCallNote;
                }

                _customerCallQueueCallAttemptRepository.Save(attempt);

                _callQueueCustomerLockRepository.RelaseCallQueueCustomerLock(attempt.CallQueueCustomerId);

                var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;

                callQueueCustomer.Status                  = CallQueueStatus.Initial;
                callQueueCustomer.DateModified            = DateTime.Now;
                callQueueCustomer.ModifiedByOrgRoleUserId = orgRoleUserId;
                callQueueCustomer.CallStatus              = (long)CallStatus.CallSkipped;
                callQueueCustomer.ContactedDate           = DateTime.Now;
                _callQueueCustomerRepository.Save(callQueueCustomer);

                var customerId         = callQueueCustomer.CustomerId.HasValue ? callQueueCustomer.CustomerId.Value : 0;
                var prospectCustomerId = callQueueCustomer.ProspectCustomerId.HasValue ? callQueueCustomer.ProspectCustomerId.Value : 0;
                _callQueueCustomerRepository.UpdateOtherCustomerAttempt(attempt.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, false,
                                                                        callQueueCustomer.CallQueueId, callQueueCustomer.CallStatus, callQueueCustomer.ContactedDate);
            }
            else if (model.CallId != 0)
            {
                Call callCenterCalll = null;
                if (model.CallId > 0)
                {
                    callCenterCalll = _callCenterCallRepository.GetById(model.CallId);
                    //if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.IncorrectPhoneNumber)
                    if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.TalkedtoOtherPerson)
                    {
                        removeFromCallQueue = true;
                    }
                }
                if (!string.IsNullOrEmpty(model.SelectedDisposition))
                {
                    var tag = (ProspectCustomerTag)System.Enum.Parse(typeof(ProspectCustomerTag), model.SelectedDisposition);
                    if (tag == ProspectCustomerTag.CallBackLater)
                    {
                        isCallQueueRequsted = true;
                    }
                    else if (tag == ProspectCustomerTag.BookedAppointment || tag == ProspectCustomerTag.HomeVisitRequested || tag == ProspectCustomerTag.MobilityIssue ||
                             tag == ProspectCustomerTag.DoNotCall || tag == ProspectCustomerTag.Deceased || tag == ProspectCustomerTag.NoLongeronInsurancePlan ||
                             tag == ProspectCustomerTag.MobilityIssues_LeftMessageWithOther || tag == ProspectCustomerTag.DebilitatingDisease || tag == ProspectCustomerTag.InLongTermCareNursingHome ||
                             tag == ProspectCustomerTag.PatientConfirmed || tag == ProspectCustomerTag.CancelAppointment || tag == ProspectCustomerTag.ConfirmLanguageBarrier)
                    {
                        removeFromCallQueue = true;
                    }

                    if (tag == ProspectCustomerTag.LanguageBarrier && callQueueCustomer.CustomerId.HasValue && callQueueCustomer.CustomerId.Value > 0)
                    {
                        _customerService.UpdateIsLanguageBarrier(callQueueCustomer.CustomerId.Value, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                    }

                    if (tag == ProspectCustomerTag.RescheduleAppointment && callQueueCustomer.EventCustomerId.HasValue)
                    {
                        var eventCustomer = _eventCustomerRepository.GetById(callQueueCustomer.EventCustomerId.Value);
                        if (eventCustomer.AppointmentId.HasValue)
                        {
                            var appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value);

                            var eventInfo = _eventService.GetById(eventCustomer.EventId);

                            callQueueCustomer.EventId         = eventCustomer.EventId;
                            callQueueCustomer.AppointmentDate = appointment.StartTime;
                            callQueueCustomer.AppointmentDateTimeWithTimeZone = _smsHelper.ConvertToServerTime(appointment.StartTime, eventInfo.EventTimeZone, !DaylightSavingNotApplicableStates.Contains(eventInfo.State));
                        }
                    }

                    if (tag == ProspectCustomerTag.PatientConfirmed && callQueueCustomer.EventCustomerId.HasValue)
                    {
                        var eventCustomer = _eventCustomerRepository.GetById(callQueueCustomer.EventCustomerId.Value);
                        eventCustomer.IsAppointmentConfirmed = true;
                        eventCustomer.ConfirmedBy            = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
                        _eventCustomerRepository.Save(eventCustomer);
                    }
                }

                var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
                _callQueueCustomerContactService.EndActiveCall(callQueueCustomer, model.CallId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue, model.CallOutcomeId, model.SkipCallNote);

                var customerId         = callQueueCustomer.CustomerId ?? 0;
                var prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0;

                if (prospectCustomerId == 0)
                {
                    var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId);
                    if (prospectCustomer != null)
                    {
                        prospectCustomerId = prospectCustomer.Id;
                    }
                }
                _callQueueCustomerRepository.UpdateOtherCustomerAttempt(model.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, model.CallOutcomeId);
            }
            //_callQueueCustomerRepository.UpdateOtherCustomerAttempt(model.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, model.CallOutcomeId);
            return(true);
        }
        private CustomerCallQueueCallAttempt SetCustomerCallQueueAttempt(CallQueueCustomer callQueueCustomer)
        {
            try
            {
                var lockedCustomer = _callQueueCustomerLockRepository.GetCallQueueCustomerLock(callQueueCustomer);

                if (lockedCustomer != null)
                {
                    return(null);
                }

                var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(callQueueCustomer.CustomerId.Value);

                Customer customer = null;
                if (prospectCustomer == null)
                {
                    customer = _customerRepository.GetCustomer(callQueueCustomer.CustomerId.Value);
                }

                using (var scope = new TransactionScope())
                {
                    //lock customer in call queue so that other agent not be able to call them;
                    var domain = new CallQueueCustomerLock
                    {
                        CallQueueCustomerId = callQueueCustomer.Id,
                        CustomerId          = callQueueCustomer.CustomerId,
                        ProspectCustomerId  = callQueueCustomer.ProspectCustomerId,
                        CreatedBy           = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId,
                        CreatedOn           = DateTime.Now
                    };

                    _callQueueCustomerLockRepository.SaveCallQueueCustomerLock(domain);                                     //Lock Customer

                    callQueueCustomer.Status                  = CallQueueStatus.InProcess;
                    callQueueCustomer.DateModified            = DateTime.Now;
                    callQueueCustomer.ModifiedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;

                    _callQueueCustomerRepository.Save(callQueueCustomer, false);                                                  //Update CallQueueCustomer Status



                    if (prospectCustomer == null && customer != null)
                    {
                        prospectCustomer = _prospectCustomerFactory.CreateProspectCustomerFromCustomer(customer, false);
                        ((IUniqueItemRepository <ProspectCustomer>)_prospectCustomerRepository).Save(prospectCustomer);
                    }

                    var customerCallQueueCallAttempt = new CustomerCallQueueCallAttempt
                    {
                        DateCreated              = DateTime.Now,
                        IsCallSkipped            = false,
                        IsNotesReadAndUnderstood = false,
                        CreatedBy             = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId,
                        CustomerId            = callQueueCustomer.CustomerId.Value,
                        CallId                = null,
                        CallQueueCustomerId   = callQueueCustomer.Id,
                        NotInterestedReasonId = null
                    };

                    var callAttempt = _customerCallQueueCallAttemptRepository.Save(customerCallQueueCallAttempt);           //CustomerCallQueueCallAttempt Entry
                    scope.Complete();
                    return(callAttempt);
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Some Error occured");
                _logger.Error("Message: " + ex.Message);
                _logger.Error("Stack Trace: " + ex.StackTrace);
            }
            return(null);
        }