Exemple #1
0
        public long SetCallDetail(long organizationRoleUserId, long calledCustomerId = 0, string calledInNumber = "", string callerNumber = "", string callStatus = "", long?campaignId = null, long?healthPlanId = null, string customTags = "",
                                  long?callQueueId = null, long callId = 0, bool readAndUnderstood = false, long eventId = 0, string callQueueCategory = "", long?dialerType = null, long?ProductTypeId = null)
        {
            var objCcRepCall = new Call
            {
                Id = callId,
                CreatedByOrgRoleUserId = organizationRoleUserId,
                StartTime         = DateTime.Now,
                CalledInNumber    = calledInNumber,
                CallerNumber      = callerNumber,
                CallBackNumber    = callerNumber,
                CallStatus        = callStatus,
                IsIncoming        = false,
                CalledCustomerId  = calledCustomerId,
                DateCreated       = DateTime.Now,
                DateModified      = DateTime.Now,
                CampaignId        = campaignId,
                HealthPlanId      = healthPlanId,
                CustomTags        = !string.IsNullOrEmpty(customTags) ? customTags : null,
                CallQueueId       = callQueueId,
                ReadAndUnderstood = readAndUnderstood,
                EventId           = eventId,
                IsContacted       = !string.IsNullOrEmpty(callQueueCategory) && (callQueueCategory != HealthPlanCallQueueCategory.AppointmentConfirmation) ? false : (bool?)null,
                DialerType        = dialerType,
                ProductTypeId     = ProductTypeId
            };
            var call = _callCenterCallRepository.Save(objCcRepCall);

            return(call.Id);
        }
        public ActionResult StartCall(string cn, string dn, bool isInbound)
        {
            var call = new Call
            {
                CreatedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId,
                StartTime      = DateTime.Now,
                IsIncoming     = isInbound,
                CalledInNumber = dn,
                CallerNumber   = cn,
                DateCreated    = DateTime.Now,
                DateModified   = DateTime.Now,
                Status         = (long)CallStatus.Initiated
            };

            call = _callCenterCallRepository.Save(call);

            GuId = Guid.NewGuid().ToString();

            var registrationFlow = new RegistrationFlowModel
            {
                GuId   = GuId,
                CallId = call.Id,
                PreQualificationResultId = 0
            };

            RegistrationFlow = registrationFlow;
            Response.RedirectUser("~/App/CallCenter/CallCenterRep/BasicCallInfo.aspx?guid=" + GuId);

            return(null);
        }
        private bool UpdateCallDetails(long callId, long?callOutcomeId, string skipCallNotes)
        {
            var call = _callCenterCallRepository.GetById(callId);

            if (callOutcomeId.HasValue && callOutcomeId == (long)CallStatus.CallSkipped)
            {
                call.Status = callOutcomeId.Value;
                if (!string.IsNullOrEmpty(skipCallNotes))
                {
                    SaveNotes(skipCallNotes, callId);
                }
            }
            call.EndTime      = DateTime.Now;
            call.DateModified = DateTime.Now;
            _callCenterCallRepository.Save(call);

            return(true);
        }
        private Call SaveCall(CallUploadLog callLog, long eventId, long orgRoleUserId, long healthPlanId)
        {
            var call = new Call
            {
                CalledCustomerId       = callLog.CustomerId,
                StartTime              = callLog.OutreachDateTime,
                EndTime                = callLog.OutreachDateTime.Value.AddMinutes(2),
                DateCreated            = callLog.OutreachDateTime.Value,
                CallStatus             = CallType.Existing_Customer.ToString().Replace("_", " "),
                EventId                = eventId,
                IsIncoming             = false,
                Status                 = (long)callLog.OutcomeEnum.Value,
                Disposition            = callLog.DispositionEnum.HasValue ? ((ProspectCustomerTag)callLog.DispositionEnum.Value).ToString() : string.Empty,
                IsUploaded             = true,
                IsNewCustomer          = false,
                CreatedByOrgRoleUserId = orgRoleUserId,
                CallDateTime           = callLog.OutreachDateTime.Value,
                DateModified           = callLog.OutreachDateTime.Value,
                NotInterestedReasonId  = callLog.ReasonEnum,
                HealthPlanId           = healthPlanId
            };

            return(_callCenterCallRepository.Save(call));
        }
Exemple #5
0
        public long SaveGmsDialerCall(GmsDialerCallModel model, long orgRoleUserId, ILogger logger)
        {
            var callDateTime = Convert.ToDateTime(model.CallDate + " " + model.CallTime);

            long status      = 0;
            var  disposition = string.Empty;

            if (model.CallDisposition.ToUpper() == "ANS.MACH")//Left Voice mail
            {
                status = (long)CallStatus.VoiceMessage;
            }
            else if (model.CallDisposition.ToUpper() == "NO.ANS") //No Answer/Busy/Mail Full
            {
                status = (long)CallStatus.NoAnswer;
            }
            else if (model.CallDisposition.ToUpper() == "BUSY") //No Answer/Busy/Mail Full
            {
                status = (long)CallStatus.NoAnswer;
            }
            else if (model.CallDisposition.ToUpper() == "DEAD")
            { //Incorrect Phone number
                status      = (long)CallStatus.TalkedtoOtherPerson;
                disposition = ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers.ToString();
            }

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

            long customerId = Convert.ToInt64(model.CustomerId);
            var  customer   = _customerRepository.GetCustomer(customerId);

            var healthPlanId = _corporateAccountRepository.GetHealthPlanIdByAccountName(model.HealthPlan);

            if (healthPlanId == 0)
            {
                logger.Info(string.Format("Unable to parse for Customer Id : {0}. Healthplan not found by Name : {1}", model.CustomerId, model.HealthPlan));
                return(0);
            }

            var calledNumber = !string.IsNullOrEmpty(model.PhoneHome) ? model.PhoneHome : !string.IsNullOrEmpty(model.PhoneOffice) ? model.PhoneOffice : model.PhoneCell;

            var callQueueCustomer = _callQueueCustomerRepository.GetCallQueueCustomerByCustomerIdAndHealthPlanId(customerId, healthPlanId, HealthPlanCallQueueCategory.MailRound);

            if (callQueueCustomer == null)
            {
                logger.Info(string.Format("Unable to parse for Customer Id : {0}. Call Queue Customer not found.", model.CustomerId));
                return(0);
            }

            bool?isContacted = false;

            if (callQueue.Category == HealthPlanCallQueueCategory.AppointmentConfirmation)
            {
                isContacted = null;
            }
            else
            {
                isContacted = (status == (long)CallStatus.Attended || status == (long)CallStatus.VoiceMessage || status == (long)CallStatus.LeftMessageWithOther);
            }

            var call = new Call()
            {
                CallDateTime           = callDateTime,
                StartTime              = callDateTime,
                EndTime                = callDateTime,
                CallStatus             = CallType.Existing_Customer.GetDescription(),
                IsIncoming             = false,
                CalledCustomerId       = customerId,
                Status                 = status,
                CreatedByOrgRoleUserId = orgRoleUserId,
                IsNewCustomer          = false,
                DateCreated            = callDateTime,
                DateModified           = callDateTime,
                ReadAndUnderstood      = true,
                HealthPlanId           = healthPlanId,
                CallQueueId            = callQueue.Id,
                DialerType             = (long)DialerType.Gms,
                CalledInNumber         = model.CallerId,
                CallerNumber           = calledNumber,
                CallBackNumber         = calledNumber,
                IsContacted            = isContacted,
                Disposition            = disposition,
                ProductTypeId          = customer.ProductTypeId
            };

            call = _callCenterCallRepository.Save(call);

            if (status == (long)CallStatus.TalkedtoOtherPerson && disposition == ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers.ToString())
            {
                _customerService.UpdateIsIncorrectPhoneNumber(customerId, true, orgRoleUserId);
            }

            var callQueueCustomerCall = new CallQueueCustomerCall {
                CallQueueCustomerId = callQueueCustomer.Id, CallId = call.Id
            };

            _callQueueCustomerCallRepository.Save(callQueueCustomerCall);

            var customerAccountGlocomNumber = new CustomerAccountGlocomNumber
            {
                CallId       = call.Id,
                CustomerId   = customerId,
                GlocomNumber = PhoneNumber.ToNumber(model.CallerId),
                CreatedDate  = callDateTime,
                IsActive     = true
            };

            _customerAccountGlocomNumberService.SaveAccountCheckoutPhoneNumber(customerAccountGlocomNumber);

            bool removeFromCallQueue = status == (long)CallStatus.TalkedtoOtherPerson;
            var  callQueueStatus     = CallQueueStatus.Initial;

            if (removeFromCallQueue)
            {
                callQueueStatus = CallQueueStatus.Removed;
            }

            callQueueCustomer.Disposition = disposition;

            _callQueueCustomerContactService.SetCallQueueCustomerStatus(callQueueCustomer, callQueueStatus, orgRoleUserId, false, status, callDateTime);


            var prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0;

            if (prospectCustomerId == 0)
            {
                var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId);
                if (prospectCustomer != null)
                {
                    prospectCustomerId = prospectCustomer.Id;
                }
            }

            _callQueueCustomerRepository.UpdateOtherCustomerAttempt(callQueueCustomer.Id, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, status, callDateTime, isForParsing: true, disposition: disposition);

            return(call.Id);
        }
Exemple #6
0
        public Customer SaveCallOutCome(CallOutComeEditModel model, long organizationRoleUserId)
        {
            Customer customer         = _customerRepository.GetCustomer(model.CustomerId);
            var      isConverted      = _eventRepository.CheckCustomerRegisteredForFutureEvent(model.CustomerId);
            var      prospectCustomer = ((IProspectCustomerRepository)_prospectCustomerRepository).GetProspectCustomerByCustomerId(model.CustomerId);

            if (prospectCustomer == null)
            {
                prospectCustomer = _prospectCustomerFactory.CreateProspectCustomerFromCustomer(customer, isConverted);
            }
            else
            {
                prospectCustomer.IsConverted = isConverted;
            }

            if (model.CallStatusId == (long)CallStatus.Attended || model.CallStatusId == (long)CallStatus.VoiceMessage || model.CallStatusId == (long)CallStatus.LeftMessageWithOther ||
                model.CallStatusId == (long)CallStatus.InvalidNumber || model.CallStatusId == (long)CallStatus.NoAnswer || model.CallStatusId == (long)CallStatus.NoEventsInArea || model.CallStatusId == (long)CallStatus.TalkedtoOtherPerson)
            {
                prospectCustomer.IsContacted   = true;
                prospectCustomer.ContactedDate = DateTime.Now;
                prospectCustomer.ContactedBy   = organizationRoleUserId;
            }
            if (!string.IsNullOrEmpty(model.DispositionAlias))
            {
                prospectCustomer.Tag           = (ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.DispositionAlias);
                prospectCustomer.TagUpdateDate = DateTime.Now;
            }

            prospectCustomer         = UpdateProspectCustomer(prospectCustomer, model.CallBackDateTime);
            model.ProspectCustomerId = prospectCustomer.Id;
            // }

            var notes = string.IsNullOrWhiteSpace(model.Note) ? "" : model.Note;

            if ((ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.DispositionAlias) == ProspectCustomerTag.MemberStatesIneligibleMastectomy)
            {
                notes = notes.Replace(ProspectCustomerTag.MemberStatesIneligibleMastectomy.GetDescription() + " : ", "");
                notes = !string.IsNullOrWhiteSpace(notes) ? ProspectCustomerTag.MemberStatesIneligibleMastectomy.GetDescription() + " : " + notes : ProspectCustomerTag.MemberStatesIneligibleMastectomy.GetDescription();
            }

            SaveNotes(notes, model.CallId);
            SaveRegistrationNotes(model.CustomerId, notes, organizationRoleUserId);

            var objCall = _callCenterCallRepository.GetById(model.CallId);

            var disposition = "";
            var tag         = ProspectCustomerTag.Unspecified;

            if ((model.CallStatusId == (long)CallStatus.Attended || model.CallStatusId == (long)CallStatus.LeftMessageWithOther || model.CallStatusId == (long)CallStatus.TalkedtoOtherPerson ||
                 model.CallStatusId == (long)CallStatus.NoEventsInArea) && !string.IsNullOrEmpty(model.DispositionAlias))
            {
                tag = (ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.DispositionAlias);
                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 || tag == ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers ||
                    tag == ProspectCustomerTag.DeclinedMobileAndTransferredToHome || tag == ProspectCustomerTag.DeclinedMobileAndHomeVisit)
                {
                    model.RemoveFromQueue = true;
                }

                disposition = model.DispositionAlias;
            }

            objCall.NotInterestedReasonId = model.NotIntrestedReasonId;

            if (model.CallQueueId > 0)
            {
                var callQueue = _callQueueRepository.GetById(model.CallQueueId);
                if (callQueue != null)
                {
                    objCall.IsContacted = false;
                    if (callQueue.Category == HealthPlanCallQueueCategory.AppointmentConfirmation)
                    {
                        objCall.IsContacted = null;
                    }
                    else
                    {
                        if (model.CallStatusId == (long)CallStatus.Attended || model.CallStatusId == (long)CallStatus.VoiceMessage || model.CallStatusId == (long)CallStatus.LeftMessageWithOther || model.CallStatusId == (long)CallStatus.InvalidNumber || model.CallStatusId == (long)CallStatus.NoAnswer || model.CallStatusId == (long)CallStatus.NoEventsInArea || model.CallStatusId == (long)CallStatus.TalkedtoOtherPerson)
                        {
                            objCall.IsContacted = true;
                        }
                    }
                }
            }

            if (model.DoNotCall || tag == ProspectCustomerTag.DoNotCall)
            {
                if (model.ProspectCustomerId > 0)
                {
                    ((IProspectCustomerRepository)_prospectCustomerRepository).UpdateDoNotCallStatus(model.ProspectCustomerId, ProspectCustomerConversionStatus.Declined);
                }

                customer = _customerService.UpdateDoNotCallStatus(customer, false, (long)DoNotContactSource.CallCenter);
            }
            else if (model.CallStatusId == (long)CallStatus.Attended && tag == ProspectCustomerTag.LanguageBarrier)
            {
                customer = _customerService.UpdateIsLanguageBarrier(customer, true);
            }
            else
            {
                if (model.ProspectCustomerId > 0)
                {
                    ((IProspectCustomerRepository)_prospectCustomerRepository).UpdateDoNotCallStatus(model.ProspectCustomerId, ProspectCustomerConversionStatus.NotConverted);
                }

                customer = _customerService.UpdateDoNotCallStatus(customer, true);
            }

            if (model.CustomerId > 0 && (model.CallStatusId == (long)CallStatus.TalkedtoOtherPerson && tag == ProspectCustomerTag.IncorrectPhoneNumber_TalkedToOthers) || (model.CallStatusId == (long)CallStatus.Attended && tag == ProspectCustomerTag.IncorrectPhoneNumber))
            {
                customer = _customerService.UpdateIsIncorrectPhoneNumber(customer, true);
            }
            else if (model.CallStatusId == (long)CallStatus.InvalidNumber)
            {
                var secondLastCall = _callCenterCallRepository.GetSecondLastCall(model.CustomerId, model.CallId);
                if (secondLastCall != null && secondLastCall.Status == (long)CallStatus.InvalidNumber && secondLastCall.InvalidNumberCount == 1)
                {
                    objCall.InvalidNumberCount = 2;
                    customer = _customerService.UpdateIsIncorrectPhoneNumber(customer, true);
                }
                else
                {
                    objCall.InvalidNumberCount = 1;
                    customer = _customerService.UpdateIsIncorrectPhoneNumber(customer, false);
                }
            }
            else
            {
                objCall.InvalidNumberCount = 0;
                customer = _customerService.UpdateIsIncorrectPhoneNumber(customer, false);
            }

            if (model.CallStatusId == (long)CallStatus.Attended && (tag == ProspectCustomerTag.DeclinedMobileAndTransferredToHome || tag == ProspectCustomerTag.MemberStatesIneligibleMastectomy))
            {
                customer.ActivityId = null;
            }
            else if (objCall.Status == (long)CallStatus.Attended && (objCall.Disposition == ProspectCustomerTag.DeclinedMobileAndTransferredToHome.ToString() || objCall.Disposition == ProspectCustomerTag.MemberStatesIneligibleMastectomy.ToString()))
            {
                customer.ActivityId = model.ActivityId > 0 ? model.ActivityId : (long?)null;
            }

            if (model.CallStatusId == (long)CallStatus.Attended && tag == ProspectCustomerTag.MemberStatesIneligibleMastectomy)
            {
                customer = _customerService.UpdateDoNotCallStatuswithReason(customer, false, ProspectCustomerTag.MemberStatesIneligibleMastectomy);
                var noteId = SaveDNCNotes(ProspectCustomerTag.MemberStatesIneligibleMastectomy.GetDescription(), organizationRoleUserId);
                customer.DoNotContactReasonNotesId = noteId;
            }
            else if (objCall.Status == (long)CallStatus.Attended && objCall.Disposition == ProspectCustomerTag.MemberStatesIneligibleMastectomy.ToString())
            {
                customer = _customerService.UpdateDoNotCallStatus(customer, true);
            }

            objCall.Status      = model.CallStatusId;
            objCall.Disposition = disposition;
            _callCenterCallRepository.Save(objCall);

            UpdateOutboundCallStatus(organizationRoleUserId, model.CallQueueCustomerId, model.CallBackDateTime, model.RemoveFromQueue);

            if (objCall.Status == (long)CallStatus.Attended)
            {
                ModifyCustomerToSaveConsent(customer, model);
            }
            _customerService.SaveCustomerOnly(customer, organizationRoleUserId);

            UpdateCallProspectCustomerData(model, model.CallBackDateTime, organizationRoleUserId, model.CallQueueCustomerId, model.RemoveFromQueue);

            return(customer);
        }