public CallOutComeEditModel GetCallOutCome(long callId, long callQueueCustomerId, long customerId) { var callOutComeModel = new CallOutComeEditModel(); var objCall = _callCenterCallRepository.GetById(callId); if (objCall == null) { return(callOutComeModel); } callOutComeModel.CallStatusId = objCall.Status; callOutComeModel.NotIntrestedReasonId = objCall.NotInterestedReasonId; var objNote = _callCenterNotesRepository.GetByCallId(callId); if (objNote != null) { callOutComeModel.Note = objNote.Notes.Replace(ProspectCustomerTag.MemberStatesIneligibleMastectomy.GetDescription(), "").Replace(":", "").Trim(); } callOutComeModel.DispositionAlias = objCall.Disposition; var customer = _customerRepository.GetCustomer(customerId); if (customer.DoNotContactTypeId.HasValue && (customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotContact || customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotCall)) { callOutComeModel.DoNotCall = true; } callOutComeModel.PhoneHome = customer.HomePhoneNumber.FormatPhoneNumber; callOutComeModel.PhoneHomeConsent = customer.PhoneHomeConsentId; callOutComeModel.PhoneOffice = customer.OfficePhoneNumber.FormatPhoneNumber; callOutComeModel.PhoneOfficeConsent = customer.PhoneOfficeConsentId; callOutComeModel.PhoneCell = customer.MobilePhoneNumber.FormatPhoneNumber; callOutComeModel.PhoneCellConsent = customer.PhoneCellConsentId; if (customerId > 0 && objCall.Disposition == (ProspectCustomerTag.CallBackLater).ToString()) { var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); if (prospectCustomer != null && prospectCustomer.IsQueuedForCallBack && prospectCustomer.CallBackRequestedOn.HasValue) //&& prospectCustomer.CallBackRequestedOn.Value.Date == DateTime.Today { callOutComeModel.CallBackDateTime = prospectCustomer.CallBackRequestedDate; } } if (callQueueCustomerId > 0) { var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); if (callQueueCustomer.Status == CallQueueStatus.Removed) { callOutComeModel.RemoveFromQueue = true; } callOutComeModel.CallQueueId = callQueueCustomer.CallQueueId; } return(callOutComeModel); }
public ActionResult RegisterForEvent(long callQueueCustomerId, long eventId, long callId, long attemptId, bool isGmsCall = false, bool isViciCall = false, long previousEventId = 0) { var guid = Guid.NewGuid().ToString(); CallQueueCustomer callQueueCustomer = null; long customerId = 0; long prospectCustomerId = 0; long campaignId = 0; if (callQueueCustomerId > 0) { callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); customerId = callQueueCustomer.CustomerId.HasValue ? callQueueCustomer.CustomerId.Value : 0; prospectCustomerId = callQueueCustomer.ProspectCustomerId.HasValue ? callQueueCustomer.ProspectCustomerId.Value : 0; campaignId = callQueueCustomer.CampaignId.HasValue ? callQueueCustomer.CampaignId.Value : 0; } else { var call = _callCenterCallRepository.GetById(callId); customerId = call.CalledCustomerId; } var registrationFlow = new RegistrationFlowModel { GuId = guid, CallId = callId, EventId = eventId, CallQueueCustomerId = callQueueCustomerId, CustomerId = customerId, ProspectCustomerId = prospectCustomerId, CampaignId = campaignId, AttempId = attemptId, IsGmsCall = isGmsCall, IsViciCall = isViciCall }; Session[guid] = registrationFlow; if (registrationFlow.CustomerId > 0) { if (previousEventId > 0) { _eventCustomerQuestionAnswerService.UpdatePreQualifiedTestAnswers(customerId, eventId, previousEventId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } _callCenterCallRepository.UpdateCallCenterCallStatus(CallType.Existing_Customer.ToString().Replace("_", " "), callId); string redirectUrl = _settings.AppUrl + "/App/CallCenter/CallCenterRep/ExistingCustomer/ExistingCustomer.aspx?CustomerType=Existing&CustomerID=" + registrationFlow.CustomerId + "&guid=" + guid; Response.RedirectUser(redirectUrl); return(null); } if (registrationFlow.ProspectCustomerId > 0) { _callCenterCallRepository.UpdateCallCenterCallStatus(CallType.Register_New_Customer.ToString().Replace("_", " "), callId); string redirectUrl = _settings.AppUrl + "/App/CallCenter/CallCenterRep/ExistingCustomer/ExistingCustomer.aspx?CustomerType=New&guid=" + guid; Response.RedirectUser(redirectUrl); return(null); } return(null); }
public void StartOutboundCall(long customerId, long prospectCustomerId, long callQueueCustomerId) { var organizationRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var callId = _outboundCallQueueService.SetCallDetail(organizationRoleUserId, customerId); var guid = Guid.NewGuid().ToString(); var registrationFlow = new RegistrationFlowModel { GuId = guid, CallId = callId, CallQueueCustomerId = callQueueCustomerId }; var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); callQueueCustomer.Status = CallQueueStatus.InProcess; callQueueCustomer.DateModified = DateTime.Now; callQueueCustomer.ModifiedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _callQueueCustomerRepository.Save(callQueueCustomer); var callQueueCustomerCall = new CallQueueCustomerCall { CallQueueCustomerId = callQueueCustomerId, CallId = callId }; _callQueueCustomerCallRepository.Save(callQueueCustomerCall); Session[guid] = registrationFlow; if (customerId == 0 && prospectCustomerId > 0) { UpdateContactedInfo(prospectCustomerId); registrationFlow.ProspectCustomerId = prospectCustomerId; Response.RedirectUser("/App/CallCenter/CallCenterRep/BasicCallInfo.aspx?guid=" + guid); } else if (customerId > 0) { var customer = _customerRepository.GetCustomer(customerId); var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); if (prospectCustomer != null) { UpdateContactedInfo(prospectCustomer.Id); registrationFlow.ProspectCustomerId = prospectCustomer.Id; } Response.RedirectUser("/App/CallCenter/CallCenterRep/CustomerVerification.aspx?CustomerID=" + customerId + "&Zip=" + customer.Address.ZipCode.Zip + "&guid=" + guid); } }
public bool EndActiveCall([FromUri] long callQueueCustomerId, [FromUri] long callId, [FromUri] bool isCallQueueRequsted, [FromUri] bool removeFromCallQueue) { var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _callQueueCustomerContactService.EndActiveCall(callQueueCustomer, callId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue); 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(callQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId); return(true); }
public bool LockCallQueueCustomer([FromUri] long callQueueCustomerId) { var customer = _callQueueCustomerRepository.GetById(callQueueCustomerId); var domain = new CallQueueCustomerLock { CallQueueCustomerId = customer.Id, CustomerId = customer.CustomerId, ProspectCustomerId = customer.ProspectCustomerId, CreatedBy = 1, CreatedOn = DateTime.Now }; _callQueueCustomerLockRepository.SaveCallQueueCustomerLock(domain); return(true); }
public long StartCallAndUpdateCallAttemptTable(long callQueueCustomerId, long callAttemptId, string calledGlocomNumber, string patientPhoneNumber, string callQueueCategory) { var callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(callQueueCustomer.CustomerId.Value); var oldCustomerGlocomNumber = _customerAccountGlocomNumberRepository.GetByCustomerIdAndGlocomNumber(callQueueCustomer.CustomerId.Value, calledGlocomNumber.Replace("-", "")); var incomingPhoneLine = calledGlocomNumber.Replace("-", ""); var callersPhoneNumber = patientPhoneNumber.Replace("-", ""); var customer = _customerRepository.GetCustomer((long)callQueueCustomer.CustomerId); using (var scope = new TransactionScope()) { var organizationRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var callStatus = CallType.Existing_Customer.ToString().Replace("_", " "); var eventId = callQueueCustomer.EventId.HasValue && callQueueCustomer.EventCustomerId.HasValue ? callQueueCustomer.EventId.Value : 0; var callId = _outboundCallQueueService.SetCallDetail(organizationRoleUserId, callQueueCustomer.CustomerId.Value, incomingPhoneLine, callersPhoneNumber, callStatus, callQueueCustomer.CampaignId, callQueueCustomer.HealthPlanId, null, callQueueCustomer.CallQueueId, eventId: eventId, callQueueCategory: callQueueCategory, ProductTypeId: customer.ProductTypeId); UpdateContactedInfo(prospectCustomer.Id, callId); _customerCallQueueCallAttemptService.SetCallIdCallAttempt(callAttemptId, callId); var callQueueCustomerCallModel = new CallQueueCustomerCall(); callQueueCustomerCallModel.CallId = callId; callQueueCustomerCallModel.CallQueueCustomerId = callQueueCustomerId; _callQueueCustomerCallRepository.Save(callQueueCustomerCallModel); var customerAccountGlocomNumber = new CustomerAccountGlocomNumber { CallId = callId, CustomerId = callQueueCustomer.CustomerId.Value, GlocomNumber = calledGlocomNumber, CreatedDate = DateTime.Now, IsActive = true }; var editmodel = new CallQueueCustomerCallDetailsEditModel { CallQueueCustomerId = callQueueCustomerId, Disposition = string.Empty, CallStatusId = (long)CallStatus.Initiated, IsCallSkipped = false, ModifiedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, Attempt = 0, CallQueueStatus = (long)CallQueueStatus.Initial, CallDate = DateTime.Today.AddDays(30), CallQueueId = callQueueCustomer.CallQueueId }; _callQueueCustomerRepository.UpdateCallqueueCustomerByCustomerId(editmodel, callQueueCustomer.CustomerId.Value); if (oldCustomerGlocomNumber != null) { oldCustomerGlocomNumber.IsActive = false; _customerAccountGlocomNumberRepository.Update(oldCustomerGlocomNumber); } _accountCheckoutPhoneNumberService.SaveAccountCheckoutPhoneNumber(customerAccountGlocomNumber); scope.Complete(); return(callId); } }
public CallQueueCustomerNotesViewModel GetCustomerNotes(long callId, long callQueueCustomerId) { var callHistoryModel = new List <CallHistoryViewModel>(); CallQueueCustomer callQueueCustomer = null; long customerId = 0; long prospectCustomerId = 0; if (callQueueCustomerId > 0) { callQueueCustomer = _callQueueCustomerRepository.GetById(callQueueCustomerId); customerId = callQueueCustomer.CustomerId ?? 0; prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0; } else { var call = _callCenterCallRepository.GetById(callId); customerId = call != null ? call.CalledCustomerId : 0; } var calls = _callCenterCallRepository.GetCallsForCallQueueCustomer(callId, customerId, prospectCustomerId); if (calls != null && calls.Any()) { var callCenterNotes = _callCenterNotesRepository.GetByCallIds(calls.Select(x => x.CallId)); var agentNameIds = _organizationRoleUserRepository.GetNameIdPairofUsers(calls.Select(x => x.CreatedByOrgRoleUserId).ToArray()); var callHistoryList = new List <CallHistoryViewModel>(); foreach (var customerCall in calls) { var agentNameId = agentNameIds.First(c => c.FirstValue == customerCall.CreatedByOrgRoleUserId); var dispositionValue = "N/A"; if (!string.IsNullOrEmpty(customerCall.Disposition)) { ProspectCustomerTag disposition; Enum.TryParse(customerCall.Disposition, out disposition); if (Enum.IsDefined(typeof(ProspectCustomerTag), disposition)) { dispositionValue = disposition.GetDescription(); } } var callHistory = new CallHistoryViewModel() { CallId = customerCall.CallId, DateCreated = customerCall.CallDateTime, CallOutcome = ((CallStatus)customerCall.Status).GetDescription(), RequestedCallBack = callQueueCustomer != null ? callQueueCustomer.CallDate : (DateTime?)null, CreatedBy = agentNameId.SecondValue, Disposition = dispositionValue, NotInterestedReason = customerCall.NotInterestedReasonId.HasValue ? ((NotInterestedReason)customerCall.NotInterestedReasonId).GetDescription() : "N/A" }; if (callCenterNotes != null && callCenterNotes.Any()) { var customerNotes = callCenterNotes.Where(ccn => ccn.CallId == customerCall.CallId).Select(ccn => ccn).ToArray(); callHistory.Notes = customerNotes.Select(cn => new NotesViewModel() { Note = cn.Notes, EnteredOn = cn.DateCreated }).OrderByDescending(x => x.EnteredOn); } callHistoryList.Add(callHistory); } callHistoryModel.AddRange(callHistoryList.OrderByDescending(x => x.DateCreated).ToList()); } var mailHistoryList = new List <DirectMailViewModel>(); if (customerId > 0) { var directMails = _directMailRepository.GetByCustomerId(customerId); if (directMails != null && directMails.Any()) { var agentNameIds = _organizationRoleUserRepository.GetNameIdPairofUsers(directMails.Select(x => x.Mailedby).ToArray()); var directMailTypes = _directMailTypeRepository.GetAll(); foreach (var directMail in directMails) { var agentNameId = agentNameIds.First(c => c.FirstValue == directMail.Mailedby); var directMailSentToCustomer = "N/A"; if (directMail.DirectMailTypeId.HasValue) { directMailSentToCustomer = directMailTypes.Single(x => x.Id == directMail.DirectMailTypeId.Value).Name; } mailHistoryList.Add(new DirectMailViewModel() { DateCreated = directMail.MailDate, CreatedBy = agentNameId.SecondValue, DirectMailType = directMailSentToCustomer, Notes = directMail.IsInvalidAddress ? directMail.Notes : "N/A" }); } } } var customerCallNotesViewModel = new List <CustomerCallNotesViewModel>(); if (customerId > 0) { var customerCallNotes = _customerCallNotesRepository.GetCustomerNotes(customerId).ToList(); var orders = _orderRepository.GetAllOrdersForCustomer(customerId); if (orders != null && orders.Count() > 0) { var refundRequests = _refundRequestRepository.GeRefundRequestByOrderIds(orders.Select(oec => oec.Id).ToArray(), RefundRequestType.CustomerCancellation); if (refundRequests != null && refundRequests.Count() > 0) { var refundRequestNotes = new List <CustomerCallNotes>(); foreach (var refundRequest in refundRequests) { refundRequestNotes.Add(new CustomerCallNotes { CustomerId = customerId, Notes = refundRequest.Reason, NotesType = CustomerRegistrationNotesType.CancellationNote, DataRecorderMetaData = new DataRecorderMetaData(refundRequest.RequestedByOrgRoleUserId, refundRequest.RequestedOn, null) }); } customerCallNotes = customerCallNotes.Concat(refundRequestNotes).ToList(); } } if (!customerCallNotes.IsNullOrEmpty()) { customerCallNotes = customerCallNotes.OrderByDescending(x => x.DataRecorderMetaData.DateCreated).ToList(); var orgRoleUserIds = customerCallNotes.Select(x => x.DataRecorderMetaData.DataRecorderCreator.Id).ToArray(); orgRoleUserIds = orgRoleUserIds.Distinct().ToArray(); var agentNameIds = _organizationRoleUserRepository.GetNameIdPairofUsers(orgRoleUserIds); customerCallNotesViewModel.AddRange(from notes in customerCallNotes let createdBy = agentNameIds.First(x => x.FirstValue == notes.DataRecorderMetaData.DataRecorderCreator.Id).SecondValue select GetCustomerCallNotesViewModel(notes, createdBy)); } } var notesViewModel = new CallQueueCustomerNotesViewModel { CallHistory = callHistoryModel, CustomerCallNotes = customerCallNotesViewModel, DirectMail = mailHistoryList }; return(notesViewModel); }
public bool EndHealthPlanActiveCall(EndHealthPlanCallEditModel model) { var isCallQueueRequsted = false; var removeFromCallQueue = false; long customerId = 0; var callQueueCustomer = _callQueueCustomerRepository.GetById(model.CallQueueCustomerId); if (callQueueCustomer != null) { customerId = callQueueCustomer.CustomerId ?? 0; } //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; } _customerCallQueueCallAttemptRepository.Save(attempt); } else if (model.CallId != 0) { Call callCenterCalll = null; if (model.CallId > 0) { callCenterCalll = _callCenterCallRepository.GetById(model.CallId); customerId = callCenterCalll != null ? callCenterCalll.CalledCustomerId : 0; 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 && customerId > 0) { _customerService.UpdateIsLanguageBarrier(customerId, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } if (tag == ProspectCustomerTag.IncorrectPhoneNumber && customerId > 0) { _customerService.UpdateIsIncorrectPhoneNumber(customerId, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } if (tag == ProspectCustomerTag.RescheduleAppointment && callQueueCustomer != null && 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 != null && 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); if (callQueueCustomer != null) { 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); } } return(true); }