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 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); } }
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); }