private bool UpdateCallProspectCustomerData(CallOutComeEditModel model, DateTime?callDateTime, long orgRoleUserId, long callQueueCustomerId, bool isRemovedFromQueue) { var disposition = (ProspectCustomerTag)Enum.Parse(typeof(ProspectCustomerTag), model.DispositionAlias); var tag = disposition == ProspectCustomerTag.Unspecified ? string.Empty : model.DispositionAlias; var callDate = callDateTime.HasValue ? callDateTime.Value : model.CallStatusId == (long)CallStatus.CallSkipped ? DateTime.Now.AddDays(1) : DateTime.Now.AddDays(30); var editmodel = new CallQueueCustomerCallDetailsEditModel { CallQueueCustomerId = callQueueCustomerId, Disposition = tag, CallStatusId = model.CallStatusId, CallbackDate = tag == ProspectCustomerTag.CallBackLater.ToString() ? model.CallBackDateTime : null, IsCallSkipped = model.CallStatusId == (long)CallStatus.CallSkipped, ModifiedByOrgRoleUserId = orgRoleUserId, Attempt = 0, CallQueueStatus = (long)(isRemovedFromQueue ? CallQueueStatus.Removed : CallQueueStatus.Initial), CallDate = callDate, }; //bool setOtherCustomerStatus = !(disposition == ProspectCustomerTag.CancelAppointment || disposition == ProspectCustomerTag.RescheduleAppointment // || disposition == ProspectCustomerTag.CHATCompleted || disposition == ProspectCustomerTag.RequestedCHATMailed || disposition == ProspectCustomerTag.MemberDoesntHaveTimeForQuestions // || disposition == ProspectCustomerTag.MemberDoesNotFeelComfortableAnsweringQuestions || disposition == ProspectCustomerTag.FollowUpCallEscalated || disposition == ProspectCustomerTag.MemberConfirmedChange // || disposition == ProspectCustomerTag.NotInterested); bool setOtherCustomerStatus = !(disposition == ProspectCustomerTag.PatientConfirmed || disposition == ProspectCustomerTag.CancelAppointment || disposition == ProspectCustomerTag.ConfirmLanguageBarrier || disposition == ProspectCustomerTag.ConfirmedHRANotComplete); _callQueueCustomerRepository.UpdateCallqueueCustomerByCustomerId(editmodel, model.CustomerId, setOtherCustomerStatus); 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); } }