public void SaveNoShowCallQueueCustomers(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger) { try { logger.Info(string.Format("Started-NoShowCallQueueCustomers HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); var startDate = queueCriteria.StartDate.HasValue ? queueCriteria.StartDate.Value : new DateTime(DateTime.Today.Year, 1, 1);// DateTime.Now.AddDays(-_noPastAppointmentInDays); var endDate = queueCriteria.EndDate.HasValue ? queueCriteria.EndDate.Value : DateTime.Now.Date; var customersList = _customerRepository.GetCustomersMarkedNoShowForHealthPlanCallQueue(corporateAccount.Tag, startDate, endDate); if (!customersList.IsNullOrEmpty()) { var callQueueCustomerList = GetCallQueueCustomers(customersList, callQueue.Id, corporateAccount.Id); logger.Info(" Count " + callQueueCustomerList.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomerList, corporateAccount.Id, queueCriteria.Id, callQueue.Id); } logger.Info(string.Format("Completed-NoShowCallQueueCustomers HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); } catch (Exception exception) { logger.Error(string.Format("error while saving data from SaveNoShowCallQueueCustomers. HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace)); } }
public HealthPlanCallQueueCriteria GetSystemGeneratedCallQueueCriteria(long callQueueId, long healthPlanId, long?organizationUserRoleId, long campaignId, long?criterialId = null) { var callQueue = _callQueueRepository.GetById(callQueueId); HealthPlanCallQueueCriteria criteria = null; if (callQueue.Category == HealthPlanCallQueueCategory.LanguageBarrier) { criteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueue(callQueueId, healthPlanId); } else { criteria = criterialId.HasValue ? _healthPlanCallQueueCriteriaRepository.GetById(criterialId.Value) : _healthPlanCallQueueCriteriaRepository.GetQueueCriteria(callQueueId, organizationUserRoleId, healthPlanId, DateTime.Today); } return(criteria); }
public HealthPlanCallQueueCriteriaEditModel DomainToModel(HealthPlanCallQueueCriteria domain) { return(new HealthPlanCallQueueCriteriaEditModel { Id = domain.Id, CallQueueId = domain.CallQueueId, HealthPlanId = domain.HealthPlanId.HasValue ? domain.HealthPlanId.Value : 0, Radius = domain.Radius.HasValue ? domain.Radius.Value : 0, Zipcode = domain.ZipCode, NoOfDays = domain.NoOfDays, NoOfDaysOfEvents = domain.NoOfDays, RoundOfCalls = domain.RoundOfCalls, StartDate = domain.StartDate, EndDate = domain.EndDate, Percentage = (int)domain.Percentage, CriteriaName = domain.CriteriaName, LanguageId = domain.LanguageId }); }
public long CustomerCountForHealthPlanCriteria(HealthPlanCallQueueCriteria criteria, IEnumerable <CallQueue> callQueues, bool isForDashboard = false) { var callQueueCategory = callQueues.FirstOrDefault(x => x.Id == criteria.CallQueueId).Category; long totalCustomersForCriteria = 0; var filter = new OutboundCallQueueFilter { CallQueueId = criteria.CallQueueId, CriteriaId = criteria.Id, HealthPlanId = criteria.HealthPlanId ?? 0, GmsAccountIds = _settings.GmsAccountIds //Radius = 25, //ZipCode = criteria.ZipCode }; if (callQueueCategory == HealthPlanCallQueueCategory.FillEventsHealthPlan) { _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter); totalCustomersForCriteria = _callQueueCustomerRepository.GetCallQueueCustomerCountForHealthPlanFillEvents(filter, isForDashboard); } else if (callQueueCategory == HealthPlanCallQueueCategory.MailRound) { filter.CampaignId = criteria.CampaignId; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter); totalCustomersForCriteria = _callQueueCustomerRepository.GetMailRoundCallqueueCustomerCount(filter, isForDashboard); } else if (callQueueCategory == HealthPlanCallQueueCategory.LanguageBarrier) { _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter); totalCustomersForCriteria = _callQueueCustomerRepository.GetLanguageBarrierCallQueueCustomerCount(filter, isForDashboard); } else if (callQueueCategory == HealthPlanCallQueueCategory.AppointmentConfirmation) { _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter); totalCustomersForCriteria = _callQueueCustomerRepository.GetConfirmationCallQueueCustomerCount(filter); } return(totalCustomersForCriteria); }
private void SaveFileInfoForCsvUpload(HealthPlanCallQueueCriteriaEditModel model, HealthPlanCallQueueCriteria criteria) { if (!model.UploadFileName.IsNullOrEmpty()) { var file = new FileInfo(_mediaRepository.GetTempMediaFileLocation().PhysicalPath + model.UploadFileName); var files = new File { Path = file.Name, FileSize = file.Length, Type = FileType.Csv, UploadedBy = new OrganizationRoleUser(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId), UploadedOn = file.CreationTime, IsArchived = false }; files = _fileRepository.Save(files); var healthPlanCriteriaAssignmentUpload = new HealthPlanCriteriaAssignmentUpload { FileId = files.Id, UploadTime = file.CreationTime, UploadedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, CriteriaId = criteria.Id }; _healthPlanCriteriaAssignmentUploadRepository.Save(healthPlanCriteriaAssignmentUpload); model.UploadFileName = null; System.IO.File.Copy(_mediaRepository.GetTempMediaFileLocation().PhysicalPath + file.Name, _mediaRepository.GetMassAgentAssignmentUploadMediaFileLocation().PhysicalPath + file.Name); } }
public HealthPlanCallQueueCriteriaEditModel SaveHealthPlanCallQueueCriteria(HealthPlanCallQueueCriteriaEditModel model, long orgRoleId, bool isCriteriaSameAsPervious) { var callQueue = _callQueueRepository.GetCallQueueByCategory(model.CallQueue); model.CallQueueId = callQueue.Id; model.IsCriteriaSameAsPervious = isCriteriaSameAsPervious; if (model.CallQueue == HealthPlanCallQueueCategory.MailRound) { model.IsCriteriaSameAsPervious = true; var healthPlanCallQueueCriterias = new List <HealthPlanCallQueueCriteria>(); HealthPlanCallQueueCriteria existingCriteria = model.Id > 0 ? _healthPlanCallQueueCriteriaRepository.GetById(model.Id) : null; foreach (var campaign in model.CampaignDirectMailDates) { var criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForMailRound(model, campaign.CampaignId, orgRoleId); if (existingCriteria != null) { if (existingCriteria.CampaignId.HasValue && model.CampaignDirectMailDates.Any(x => x.CampaignId == existingCriteria.CampaignId.Value)) { if (campaign.CampaignId == existingCriteria.CampaignId.Value) { criteria.Id = model.Id; criteria.IsQueueGenerated = existingCriteria.IsQueueGenerated; } } else { if (campaign.CampaignId == model.CampaignDirectMailDates.First().CampaignId) { criteria.Id = model.Id; } } } if (criteria.Id > 0) { var directmailActivities = _healthPlanCriteriaDirectMailRepository.GetByCriteriaId(criteria.Id); if (directmailActivities.IsNullOrEmpty() && !campaign.DirectMailDateActivities.IsNullOrEmpty()) { criteria.IsQueueGenerated = false; model.IsCriteriaSameAsPervious = false; } else if (!directmailActivities.IsNullOrEmpty() && campaign.DirectMailDateActivities.IsNullOrEmpty()) { criteria.IsQueueGenerated = false; model.IsCriteriaSameAsPervious = false; } else if (!directmailActivities.IsNullOrEmpty() && !campaign.DirectMailDateActivities.IsNullOrEmpty()) { if (directmailActivities.Count() != campaign.DirectMailDateActivities.Count()) { criteria.IsQueueGenerated = false; model.IsCriteriaSameAsPervious = false; } else { var activtyIdsInDB = directmailActivities.Select(x => x.CampaignActivityId); var activityIdsInModel = campaign.DirectMailDateActivities.Select(x => x.ActivityId); if (!(activtyIdsInDB.All(activityIdsInModel.Contains) && activityIdsInModel.All(activtyIdsInDB.Contains))) { criteria.IsQueueGenerated = false; model.IsCriteriaSameAsPervious = false; } } } } else { criteria.IsQueueGenerated = false; model.IsCriteriaSameAsPervious = false; } criteria = _healthPlanCallQueueCriteriaRepository.Save(criteria); if (!campaign.DirectMailDateActivities.IsNullOrEmpty()) { var activityIds = campaign.DirectMailDateActivities.Select(x => x.ActivityId); _healthPlanCriteriaDirectMailRepository.Save(activityIds, criteria.Id); } healthPlanCallQueueCriterias.Add(criteria); } if (!model.IsTeamAssignment) { foreach (var healthPlanCallQueueCriteria in healthPlanCallQueueCriterias) { SaveFileInfoForCsvUpload(model, healthPlanCallQueueCriteria); } if (!model.Assignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaAssignmentForMailRound(model.Assignments, healthPlanCallQueueCriterias, orgRoleId); _healthPlanCriteriaAssignmentRepository.Save(model.HealthPlanId, model.CallQueueId, model.Id, assignments); } } else { if (!model.CallCenterTeamAssignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaTeamAssignmentForMailRound(model.CallCenterTeamAssignments, healthPlanCallQueueCriterias, orgRoleId); _healthPlanCriteriaTeamAssignmentRepository.Save(assignments); } } } else if (model.CallQueue == HealthPlanCallQueueCategory.LanguageBarrier) { var healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueue(model.CallQueueId, model.HealthPlanId); if (!model.IsTeamAssignment) { if (!model.Assignments.IsNullOrEmpty()) { SaveFileInfoForCsvUpload(model, healthPlanCallQueueCriteria); var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaAssignment(model.Assignments, healthPlanCallQueueCriteria.Id, orgRoleId); _healthPlanCriteriaAssignmentRepository.Save(model.HealthPlanId, model.CallQueueId, model.Id, assignments); } } else { if (!model.CallCenterTeamAssignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaTeamAssignment(model.CallCenterTeamAssignments, healthPlanCallQueueCriteria, orgRoleId); _healthPlanCriteriaTeamAssignmentRepository.Save(assignments); } } } else if (model.CallQueue == HealthPlanCallQueueCategory.AppointmentConfirmation) { var healthPlanCallQueueCriteria = model.Id > 0 ? _healthPlanCallQueueCriteriaRepository.GetById(model.Id) : _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueueByLanguage(model.CallQueue, model.HealthPlanId, model.LanguageId); var organization = _organizationRepository.GetOrganizationbyId(model.HealthPlanId); var language = model.LanguageId.HasValue ? _languageRepository.GetById(model.LanguageId.Value) : null; model.CriteriaName = organization.Name + " Confirmation" + (language != null ? " for " + language.Name : ""); if (healthPlanCallQueueCriteria == null) { healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForConfirmation(model, orgRoleId); healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.Save(healthPlanCallQueueCriteria); } else { /*if (healthPlanCallQueueCriteria.LanguageId != model.LanguageId) * healthPlanCallQueueCriteria.IsQueueGenerated = false;*/ healthPlanCallQueueCriteria.LanguageId = model.LanguageId; healthPlanCallQueueCriteria.CriteriaName = model.CriteriaName; healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.Save(healthPlanCallQueueCriteria); } if (!model.IsTeamAssignment) { if (!model.Assignments.IsNullOrEmpty()) { SaveFileInfoForCsvUpload(model, healthPlanCallQueueCriteria); var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaAssignment(model.Assignments, healthPlanCallQueueCriteria.Id, orgRoleId); _healthPlanCriteriaAssignmentRepository.Save(model.HealthPlanId, model.CallQueueId, model.Id, assignments); } } else { if (!model.CallCenterTeamAssignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaTeamAssignment(model.CallCenterTeamAssignments, healthPlanCallQueueCriteria, orgRoleId); _healthPlanCriteriaTeamAssignmentRepository.Save(assignments); } } } else { HealthPlanCallQueueCriteria criteria = null; if (!isCriteriaSameAsPervious) { if (model.CallQueue == HealthPlanCallQueueCategory.FillEventsHealthPlan) { criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForFillEvent(model, orgRoleId); } #region not in use //switch (model.CallQueue) //{ // //case HealthPlanCallQueueCategory.CallRound: // // criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForCallRound(model, orgRoleId); // // break; // case HealthPlanCallQueueCategory.FillEventsHealthPlan: // criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForFillEvent(model, orgRoleId); // break; // //case HealthPlanCallQueueCategory.NoShows: // // criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForNoShow(model, orgRoleId); // // break; // //case HealthPlanCallQueueCategory.ZipRadius: // // criteria = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCallQueueCriteriaForZipRadius(model, orgRoleId); // // break; //} #endregion _healthPlanCallQueueCriteriaRepository.MarkForDelete(model.Id, true); criteria = _healthPlanCallQueueCriteriaRepository.Save(criteria); model.Id = criteria.Id; } else if (model.Id > 0) { criteria = _healthPlanCallQueueCriteriaRepository.GetById(model.Id); criteria.DataRecorderMetaData.DateModified = DateTime.Now; criteria.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(orgRoleId); criteria.CriteriaName = model.CriteriaName; criteria = _healthPlanCallQueueCriteriaRepository.Save(criteria); } if (!model.IsTeamAssignment) { SaveFileInfoForCsvUpload(model, criteria); if (!model.Assignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaAssignment(model.Assignments, model.Id, orgRoleId); _healthPlanCriteriaAssignmentRepository.Save(model.HealthPlanId, model.CallQueueId, model.Id, assignments); } } else { if (!model.CallCenterTeamAssignments.IsNullOrEmpty()) { var assignments = _healthPlanCallQueueCriteriaEditModelFactory.GetHealthPlanCriteriaTeamAssignment(model.CallCenterTeamAssignments, criteria, orgRoleId); _healthPlanCriteriaTeamAssignmentRepository.Save(assignments); } } } if (!model.IsTeamAssignment) { if (model.Assignments != null && model.Assignments.Any()) { var list = new List <CallQueueAssignmentEditModel>(); foreach (var assignment in model.Assignments) { assignment.IsExistInOtherCriteria = false; list.Add(assignment); } model.Assignments = list; } return(model); } else { model.IsTeamAssignment = true; model.Assignments = null; return(model); } }
public HealthPlanCallQueueCriteria Save(HealthPlanCallQueueCriteria criteria) { return(_healthPlanCallQueueCriteriaRepository.Save(criteria)); }
public IEnumerable <HealthPlanCriteriaTeamAssignment> GetHealthPlanCriteriaTeamAssignment(IEnumerable <HealthPlanCriteriaTeamAssignmentEditModel> teamAssignment, HealthPlanCallQueueCriteria criteria, long orgRoleUserId) { var collection = new List <HealthPlanCriteriaTeamAssignment>(); foreach (var assignment in teamAssignment) { var data = new HealthPlanCriteriaTeamAssignment { HealthPlanCriteriaId = criteria.Id, TeamId = assignment.TeamId, StartDate = assignment.StartDate, EndDate = assignment.EndDate, DateCreated = DateTime.Now, CreatedBy = orgRoleUserId }; collection.Add(data); } return(collection); }
private bool CheckCustomerDataHasBeenUploaded(HealthPlanCallQueueCriteria criteria) { return(_corporateUploadRepository.IsFileUpladedBetweenDateTime(criteria.LastQueueGeneratedDate.HasValue ? criteria.LastQueueGeneratedDate.Value : criteria.DataRecorderMetaData.DateCreated, DateTime.Now)); }
public void SaveHealthPlanUncontactedCustomerCallQueue(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger) { try { logger.Info(string.Format("Started-SaveHealthPlanUncontactedCustomerCallQueue( HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); var customersList = _customerRepository.GetHealthPlanUncontactedCustomers(corporateAccount.Tag, _neverBeenCalledInDays, _noPastAppointmentForUncontactedCustomer); if (!customersList.IsNullOrEmpty()) { var callQueueCustomerList = GetCallQueueCustomers(customersList, callQueue.Id, corporateAccount.Id); logger.Info(" Count " + callQueueCustomerList.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomerList, corporateAccount.Id, queueCriteria.Id, callQueue.Id); } logger.Info(string.Format("Completed-SaveHealthPlanUncontactedCustomerCallQueue( HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); } catch (Exception exception) { logger.Error(string.Format("error while saving data from health plan SaveHealthPlanUncontactedCallQueueCustomers queue. HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message: {0} \n stack trace: {1} ", exception.Message, exception.StackTrace)); } }
public IEnumerable <OrderedPair <long, long> > GetHealthPlanCallQueueCustomers(long callQueueId, HealthPlanCallQueueCriteria criteria, CorporateAccount healthPlan, int pastAppointmentDays, ILogger logger) { var days = criteria.NoOfDays; var percentage = criteria.Percentage; var endDate = DateTime.Today.AddDays(days); logger.Info(string.Format("HealthPlanId: {0}, CallQueueId: {1}, CriteriaId: {2}", healthPlan.Id, callQueueId, criteria.Id)); logger.Info(string.Format("Percentage: {0}, NoOfDays: {1}, EndDate: {2}", percentage, days, endDate)); IEnumerable <Event> eventList = null; var eventForNonMammoPatient = _eventRepository.GetEventsForHealthPlanFillEventsCallQueue(endDate, healthPlan.Id, true); var eventForMammoPatient = _eventRepository.GetEventsForHealthPlanFillEventsCallQueue(endDate, healthPlan.Id, false); eventList = eventForNonMammoPatient; if (eventList != null) { eventList = eventList.Concat(eventForMammoPatient); } else { eventList = eventForMammoPatient; } if (eventList == null || !eventList.Any()) { return(null); } eventList = _fillEventsCallQueueHelper.GetAllTheEventFilledUnderPecentage(eventList, percentage); if (eventList == null || !eventList.Any()) { return(null); } if (eventForMammoPatient != null && eventForMammoPatient.Any()) { logger.Info("Mammo Event count: " + eventForMammoPatient.Count()); } else { logger.Info("No Mammo Event found"); } if (eventForNonMammoPatient != null && eventForNonMammoPatient.Any()) { logger.Info("Non-Mammo Event count: " + eventForNonMammoPatient.Count()); } else { logger.Info("No Non-Mammo Event found"); } var hostIds = eventList.Select(x => x.HostId); var eventZipMammoListModel = new List <EventZipMammoModel>(); var hostIdZipCodePairs = _hostRepository.GetHostZipId(hostIds); foreach (var theEvent in eventList) { var host = hostIdZipCodePairs.First(h => h.FirstValue == theEvent.HostId); eventZipMammoListModel.Add(new EventZipMammoModel { EventId = theEvent.Id, ZipId = host.SecondValue, IsNonMammoEvent = (eventForNonMammoPatient != null && eventForNonMammoPatient.Any(x => x.Id == theEvent.Id)) }); } var customers = _customerRepository.GetCustomerForHealthPlanFillEventCallQueue(eventZipMammoListModel, healthPlan.Tag, _settings.FillEventZipRadius, logger); return(customers); }
public void SaveCallRoundCallQueueCustomers(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger) { try { logger.Info(string.Format("Started-CallRoundCallQueueCustomers HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); var customersList = _customerRepository.GetCustomersByHealthPlanForCallRound(corporateAccount.Tag, _noPastAppointmentInDays, queueCriteria.RoundOfCalls, queueCriteria.NoOfDays); if (!customersList.IsNullOrEmpty()) { var callQueueCustomerList = GetCallQueueCustomers(customersList, callQueue.Id, corporateAccount.Id); logger.Info(" Count " + callQueueCustomerList.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomer(callQueueCustomerList, corporateAccount.Id, queueCriteria.Id, callQueue.Id); } logger.Info(string.Format("Completed-CallRoundCallQueueCustomers HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); } catch (Exception exception) { logger.Error(string.Format("error while saving data from SaveCallRoundCallQueueCustomers. HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace)); } }
public void SaveHealthPlanConfirmationCustomerCallQueue(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger) { try { logger.Info(string.Format("Starting confirmation call queue generation for HealthPlanId: {0} CallQueueId: {1} CriteriaId : {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); var customersList = _customerRepository.GetHealthPlanConfirmationQueueCustomers(corporateAccount); if (!customersList.IsNullOrEmpty()) { var callQueueCustomerList = new List <CallQueueCustomer>(); foreach (var customer in customersList) { var appointmentTime = customer.EventDate.Date.Add(customer.AppointmentTime.TimeOfDay); var callQueueCustomer = new CallQueueCustomer { CallQueueId = callQueue.Id, CustomerId = customer.CustomerId, HealthPlanId = corporateAccount.Id, EventId = customer.EventId, EventCustomerId = customer.EventCustomerId, AppointmentDate = appointmentTime, AppointmentDateTimeWithTimeZone = _smsHelper.ConvertToServerTime(appointmentTime, customer.TimeZone, !SmsHelper.DaylightSavingNotApplicableStates.Contains(customer.StateCode)) }; callQueueCustomerList.Add(callQueueCustomer); } logger.Info(" Count " + callQueueCustomerList.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomersForConfirmation(callQueueCustomerList, corporateAccount.Id, queueCriteria.Id, callQueue.Id); } logger.Info(string.Format("Completed confirmation call queue generation for HealthPlanId: {0} CallQueueId: {1} CriteriaId : {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); } catch (Exception ex) { logger.Error(string.Format("Error generating confirmation queue for HealthPlanId: {0} CallQueueId: {1} CriteriaId : {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message : {0} \nStack Trace : {1}", ex.Message, ex.StackTrace)); } }
public void SaveMailRoundCallQueueCustomers(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger, Campaign campaign) { try { var customersList = _customerRepository.GetCustomersByHealthPlanForMailRound(corporateAccount.Tag, campaign.CustomTags, campaign.Id, queueCriteria.Id); if (!customersList.IsNullOrEmpty()) { var callQueueCustomerList = GetCallQueueCustomers(customersList, callQueue.Id, corporateAccount.Id, null, campaign.Id); logger.Info(" Count " + callQueueCustomerList.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomerForMailRound(callQueueCustomerList, corporateAccount.Id, queueCriteria.Id, callQueue.Id, campaign.Id); } } catch (Exception exception) { logger.Error(string.Format("error while saving data from SaveMailRoundCallQueueCustomers. HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message {0} stack trace: {1} ", exception.Message, exception.StackTrace)); } }
private bool IsCriteriaIsSameAsPerious(HealthPlanCallQueueCriteriaEditModel model, HealthPlanCallQueueCriteria domain) { switch (model.CallQueue) { case HealthPlanCallQueueCategory.CallRound: return(domain.NoOfDays == model.NoOfDays && domain.RoundOfCalls == model.RoundOfCalls); case HealthPlanCallQueueCategory.ZipRadius: return(domain.Radius.HasValue && domain.ZipCode == model.Zipcode && domain.Radius.Value == model.Radius); case HealthPlanCallQueueCategory.FillEventsHealthPlan: return(domain.NoOfDays == model.NoOfDaysOfEvents && domain.Percentage == model.Percentage); case HealthPlanCallQueueCategory.NoShows: return(domain.StartDate == model.StartDate && domain.EndDate == model.EndDate); case HealthPlanCallQueueCategory.AppointmentConfirmation: return(domain.StartDate == model.StartDate && domain.EndDate == model.EndDate); case HealthPlanCallQueueCategory.LanguageBarrier: return(true); } return(false); }
public CallQueueCustomersReportModelListModel GetCallQueueCustomersList(IEnumerable <CallQueueCustomer> callQueueCustomers, IEnumerable <Customer> customers, IEnumerable <CorporateCustomerCustomTag> corporateCustomerCustomTags, CorporateAccount corporateAccount, bool isQueueGenerated, HealthPlanCallQueueCriteria criteriaModel) { var list = new List <CallQueueCustomersReportModel>(); foreach (var cqc in callQueueCustomers) { var customer = customers.First(c => c.CustomerId == cqc.CustomerId.Value); var customTags = string.Empty; if (corporateCustomerCustomTags != null && corporateCustomerCustomTags.Any() && cqc.CustomerId.HasValue) { var tags = corporateCustomerCustomTags.Where(x => x.CustomerId == cqc.CustomerId.Value).OrderByDescending(x => x.DataRecorderMetaData.DateCreated); if (tags != null && tags.Any()) { customTags = string.Join(",", tags.Select(x => x.Tag)); } } list.Add(new CallQueueCustomersReportModel { CustomTag = customTags, CustomerId = customer.CustomerId, MemberId = customer.InsuranceId, Name = customer.Name.ToString(), Tag = corporateAccount.Tag, ZipCode = customer.Address.ZipCode.Zip }); } if (list.IsNullOrEmpty()) { return new CallQueueCustomersReportModelListModel { IsQueueGenerated = isQueueGenerated, CallQueueCriteria = criteriaModel } } ; return(new CallQueueCustomersReportModelListModel { Collection = list, IsQueueGenerated = isQueueGenerated, CallQueueCriteria = criteriaModel }); } }
public void SaveHealthPlanFillEventCallQueueCustomers(CorporateAccount corporateAccount, HealthPlanCallQueueCriteria queueCriteria, CallQueue callQueue, ILogger logger) { try { logger.Info(string.Format("Started-FillEventCallQueueCustomers( HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); var eventCustomersPair = _fillEventsCallQueueService.GetHealthPlanCallQueueCustomers(callQueue.Id, queueCriteria, corporateAccount, _noPastAppointmentInDays, logger); if (!eventCustomersPair.IsNullOrEmpty()) { var customerIds = eventCustomersPair.Select(x => x.SecondValue).Distinct().ToArray(); var eventIds = eventCustomersPair.Select(x => x.FirstValue).Distinct(); logger.Info("Criteria Id: " + queueCriteria.Id + " Event Count " + eventIds.Count()); SaveFillEventQueueCriteria(eventIds, queueCriteria.Id); //var eventIdtoAttchedtoCustomer = _healthPlanFillEventCallQueueRepository.GetEventIdsByHealthPlanIds(corporateAccount.Id, callQueue.Id); logger.Info("Customer Count " + customerIds.Count()); _healthPlanCallQueueCustomerHelper.SaveCallQueueCustomerForFillEvent(eventCustomersPair, queueCriteria.Id, corporateAccount.Id, callQueue.Id, customerIds); } logger.Info(string.Format("Completed-FillEventCallQueueCustomers( HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); } catch (Exception exception) { logger.Error(string.Format("error while saving data from SaveHealthPlanFillEventCallQueueCustomers call queue. HealthPlanId: {0} callQueueId: {1} callqueueCriteria: {2}", corporateAccount.Id, callQueue.Id, queueCriteria.Id)); logger.Error(string.Format("Message: {0} \n stack trace: {1} ", exception.Message, exception.StackTrace)); } }