public void SetReadAndUnderstoodNotes(long callId) { var call = _callCenterCallRepository.GetById(callId); call.ReadAndUnderstood = true; _callCenterCallRepository.Save(call); }
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 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); }
public PreAssessmentCustomerContactViewModel GetByCustomerId(long customerId, long callId, long orgRoleUserId) { if (customerId <= 0) { return(null); } var call = _callCenterCallRepository.GetById(callId); var eventCustomer = _eventCustomerRepository.Get(call.EventId, customerId); CallQueue callQueue = null; if (call != null) { callQueue = _callQueueRepository.GetById((long)call.CallQueueId); } var customer = _customerRepository.GetCustomer(customerId); var memberIdLabel = string.Empty; CorporateAccount corporateAccount = null; CustomerEligibility customerEligibility = null; if (customer != null) { customerEligibility = _customerEligibilityRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); if (!string.IsNullOrEmpty(customer.Tag)) { corporateAccount = _corporateAccountRepository.GetByTag(customer.Tag); memberIdLabel = corporateAccount != null ? corporateAccount.MemberIdLabel : string.Empty; } } var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); CallQueuePatientInfomationViewModel patientInfo = null; if (customer != null) { Falcon.App.Core.Medical.Domain.ActivityType activityType = null; if (customer.ActivityId.HasValue) { activityType = _activityTypeRepository.GetById(customer.ActivityId.Value); } patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerInfo(customer, customerEligibility, activityType); } else { patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetProspectCustomerInfo(prospectCustomer); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } var additionalFileds = new List <OrderedPair <string, string> >(); if (corporateAccount != null) { var accountAdditionalFields = _accountAdditionalFieldRepository.GetByAccountId(corporateAccount.Id); if (accountAdditionalFields.Any()) { additionalFileds.AddRange(accountAdditionalFields.Select(additionalField => new OrderedPair <string, string>(additionalField.DisplayName, GetCustomerAdditionalField(customer, additionalField.AdditionalFieldId)))); } if (corporateAccount.ShowCallCenterScript && corporateAccount.CallCenterScriptFileId > 0) { var callCenterScriptPdf = _fileRepository.GetById(corporateAccount.CallCenterScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + callCenterScriptPdf.Path; } if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue) { if (corporateAccount.ShowCallCenterScript && corporateAccount.ConfirmationScriptFileId > 0) { var confirmationScriptPdf = _fileRepository.GetById(corporateAccount.ConfirmationScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + confirmationScriptPdf.Path; } } } var hasMammo = customer != null && _preApprovedTestRepository.CheckPreApprovedTestForCustomer(customer.CustomerId, TestGroup.BreastCancer); patientInfo.HasMammo = hasMammo; patientInfo.MammoTestAsPreApproved = hasMammo; patientInfo.CustomerId = customerId; patientInfo.ProspectCustomerId = prospectCustomer != null ? prospectCustomer.Id : 0; patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerTagInfo(prospectCustomer, patientInfo); if (patientInfo != null && callQueue != null && callQueue.IsHealthPlan) { patientInfo.PrimaryCarePhysician = _primaryCarePhysicianHelper.GetPrimaryCarePhysicianViewModel(customerId); } if (customer != null) { var customerCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerId(customer.CustomerId); if (!customerCustomTags.IsNullOrEmpty()) { var customTags = customerCustomTags.OrderByDescending(x => x.DataRecorderMetaData.DateCreated).Select(x => x.Tag).ToArray(); patientInfo.CustomCorporateTags = customTags.IsNullOrEmpty() ? string.Empty : string.Join(",", customTags); } } IEnumerable <string> preApprovedTests = null; var preApprovedTestsList = _preApprovedTestRepository.GetPreApprovedTests(customerId); if (preApprovedTestsList.Count() > 0) { preApprovedTests = preApprovedTestsList; } IEnumerable <Package> preApprovedPackages = null; var preApprovedPackageList = _preApprovedPackageRepository.GetByCustomerId(customerId); var packageIds = preApprovedPackageList != null?preApprovedPackageList.Select(x => x.PackageId) : null; if (packageIds != null) { preApprovedPackages = _packageRepository.GetByIds(packageIds.ToList()); } if (customer != null && customer.Address != null && customer.Address.StateId > 0 && corporateAccount != null) { patientInfo.HealthPlanPhoneNumber = _customerAccountGlocomNumberService.GetGlocomNumber(corporateAccount.Id, customer.Address.StateId, customer.CustomerId, callId); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } if (patientInfo.HealthPlanPhoneNumber != null) { string dialerUrl; var callCenterRepProfile = _callCenterRepProfileRepository.Get(orgRoleUserId); if (callCenterRepProfile != null && !string.IsNullOrEmpty(callCenterRepProfile.DialerUrl)) { dialerUrl = callCenterRepProfile.DialerUrl.ToLower().Replace(CallCenterAgentUrlKeywords.CallerId.ToLower(), (patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number)) .Replace(CallCenterAgentUrlKeywords.PatientId.ToLower(), patientInfo.CustomerId.ToString()); } else { dialerUrl = "Glocom://*65*" + patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number + "*1" + CallCenterAgentUrlKeywords.PatientContact.ToLower(); } if (patientInfo.CallBackPhoneNumber != null) { patientInfo.CallBackPhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.CallBackPhoneNumber.AreaCode + patientInfo.CallBackPhoneNumber.Number)); } if (patientInfo.OfficePhoneNumber != null) { patientInfo.OfficePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.OfficePhoneNumber.AreaCode + patientInfo.OfficePhoneNumber.Number)); } if (patientInfo.MobilePhoneNumber != null && !string.IsNullOrEmpty(patientInfo.MobilePhoneNumber.Number)) { patientInfo.MobilePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.MobilePhoneNumber.AreaCode + patientInfo.MobilePhoneNumber.Number)); } } var preAssessmentCustomerCallQueueCallAttempt = _preAssessmentCustomerCallQueueCallAttemptRepository.GetByCallId(callId); RegisteredEventViewModel registeredEventModel = null; var isCancelled = false; if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue && call.EventId > 0) { var isEawvPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV); Appointment appointment = null; if (eventCustomer.AppointmentId.HasValue) { appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value); } else { isCancelled = true; } var theEvent = _eventService.GetById(eventCustomer.EventId); var hostAddress = new AddressViewModel { StreetAddressLine1 = theEvent.StreetAddressLine1, StreetAddressLine2 = theEvent.StreetAddressLine2, City = theEvent.City, State = theEvent.State, ZipCode = theEvent.Zip }; QuestionnaireType questionnaireType = QuestionnaireType.None; if (corporateAccount != null && corporateAccount.IsHealthPlan && theEvent != null) { questionnaireType = _accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(corporateAccount.Id, theEvent.EventDate); } registeredEventModel = new RegisteredEventViewModel { EventId = theEvent.EventId, EventDate = theEvent.EventDate, AppointmentTime = appointment != null ? appointment.StartTime : (DateTime?)null, HostName = theEvent.OrganizationName, HostAddress = hostAddress.ToString(), EventNotes = "", EventCustomerId = eventCustomer.Id, TimeZone = theEvent.EventTimeZone, IsCanceled = isCancelled, HraQuestionerAppUrl = _settings.HraQuestionerAppUrl, OrganizationNameForHraQuestioner = _settings.OrganizationNameForHraQuestioner, CorporateAccountTag = corporateAccount.Tag, MedicareVisitId = eventCustomer.AwvVisitId.HasValue ? eventCustomer.AwvVisitId.Value : 0, Pods = theEvent.Pods.IsNullOrEmpty() ? "" : theEvent.PodNames(), ShowHraQuestionnaire = questionnaireType == QuestionnaireType.HraQuestionnaire ? true : false, IsEawvPurchased = isEawvPurchased, ShowChatQuestionnaire = questionnaireType == QuestionnaireType.ChatQuestionnaire ? true : false, ChatQuestionerAppUrl = _settings.ChatQuestionerAppUrl, AllowNonMammoPatients = theEvent.AllowNonMammoPatients, CaptureHaf = corporateAccount != null && corporateAccount.CaptureHaf, }; preAssessmentCustomerCallQueueCallAttempt.IsNotesReadAndUnderstood = true; } if (corporateAccount != null) { var organization = _organizationRepository.GetOrganizationbyId(corporateAccount.Id); patientInfo.HealthPlan = organization.Name; } var warmTransfer = false; if (customer != null && corporateAccount != null && corporateAccount.WarmTransfer) { var customerWarmTransfer = _customerWarmTransferRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); warmTransfer = customerWarmTransfer != null && customerWarmTransfer.IsWarmTransfer.HasValue && customerWarmTransfer.IsWarmTransfer.Value; } var model = new PreAssessmentCustomerContactViewModel { PatientInfomation = patientInfo, // CallHistory = callHistoryModel, PreApprovedTests = preApprovedTests, // ReadAndUnderstood = currentCall != null && currentCall.ReadAndUnderstood.HasValue && currentCall.ReadAndUnderstood.Value, AdditionalFields = additionalFileds, MemberIdLabel = memberIdLabel, // IsCallEnded = currentCall != null && currentCall.Status == (long)CallStatus.CallSkipped && currentCall.EndTime.HasValue, PreApprovedPackages = !preApprovedPackages.IsNullOrEmpty() ? preApprovedPackages.Select(x => x.Name).ToList() : null, CallId = callId, HealthPlanId = corporateAccount != null ? corporateAccount.Id : 0, CallQueueCustomerAttempt = preAssessmentCustomerCallQueueCallAttempt ?? new PreAssessmentCustomerCallQueueCallAttempt { IsNotesReadAndUnderstood = true }, EventInformation = registeredEventModel, WarmTransfer = warmTransfer, // RequiredTests = requiredTests, }; var isHealthPlanCallQueue = call != null; var patientInfoEditModel = _preAssessmentCallQueuePatientInfomationFactory.GetCallQueueCustomerEditModel(model, isHealthPlanCallQueue); model.PatientInfoEditModel = patientInfoEditModel; model.PatientInfoEditViewModel = patientInfoEditModel; return(model); }
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); }
public bool EndHealthPlanActiveCall(EndHealthPlanCallEditModel model) { var isCallQueueRequsted = false; var removeFromCallQueue = false; long customerId = 0; var call = _callCenterCallRepository.GetById(model.CallId); var eventCustomer = _eventCustomerRepository.Get(call.EventId, call.CalledCustomerId); customerId = call.CalledCustomerId; //update call status in CustomerCallQueueCallAttempt Table if (model.IsSkipped && model.AttemptId > 0) { var attempt = _preAssessmentCustomerCallQueueCallAttemptRepository.GetByCallId(model.CallId); attempt.IsCallSkipped = true; if (!string.IsNullOrEmpty(model.SkipCallNote)) { attempt.SkipCallNote = model.SkipCallNote; } _preAssessmentCustomerCallQueueCallAttemptRepository.Save(attempt); } else if (model.CallId != 0) { if (model.CallId > 0) { if (call != null && call.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.PatientConfirmed && call != null && eventCustomer.Id > 0) { eventCustomer.IsAppointmentConfirmed = true; eventCustomer.ConfirmedBy = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _eventCustomerRepository.Save(eventCustomer); } } var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _preAssessmentCallQueueService.EndActiveCall(customerId, model.CallId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue, model.CallOutcomeId, model.SkipCallNote); } return(true); }