public ActionResult Create(HealthPlanCallQueueCriteriaEditModel model) { try { if (!ModelState.IsValid) { return(View(model)); } else { //if ((model.Assignments == null && model.CallCenterTeamAssignments == null) // || // ((model.Assignments != null && !model.Assignments.Any()) && (model.CallCenterTeamAssignments != null && !model.CallCenterTeamAssignments.Any()))) //{ // model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Assignment must exist"); // return View(model); //} var healthPlanCriteria = _healthPlanCallQueueCriteriaRepository.GetCriteriaByHealthPlanCallQueue(model.HealthPlanId, model.CallQueue); if (!string.IsNullOrWhiteSpace(model.CriteriaName)) { model.CriteriaName = model.CriteriaName.Trim(); var criteriaNameList = _healthPlanCallQueueCriteriaRepository.GetAllHealthPlanCallQueueCriteriaNames(); if (criteriaNameList.Any(x => x.ToLower() == model.CriteriaName.ToLower())) { model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Name already exists"); return(View(model)); } } if (model.CallQueue == HealthPlanCallQueueCategory.AppointmentConfirmation) { var healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueueByLanguage(model.CallQueue, model.HealthPlanId, model.LanguageId); if (healthPlanCallQueueCriteria != null) { model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria already exists for selected language."); return(View(model)); } } bool isCriteriaExist = CheckHealthPlanCallQueueCriteriaAlreadyExists(model, healthPlanCriteria); if (isCriteriaExist) { model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria for same healthplan and call queue exist"); return(View(model)); } else { //if (model.Id > 0) //{ // //check if user has changed mode of assignment (agent assignment or team assignment) // var isTeamAssignmentOld = // _healthPlanCriteriaTeamAssignmentRepository.GetTeamAssignments(model.Id).Any(); // var isAgentAssignmentOld = // _healthPlanCriteriaAssignmentRepository.GetByCriteriaId(model.Id).Any(); // if (model.IsTeamAssignment && isAgentAssignmentOld) //delete old agent assignments // { // _healthPlanCriteriaAssignmentRepository.DeleteByCriteriaId(model.Id); // } // else if (!model.IsTeamAssignment && isTeamAssignmentOld) //delete old team assignments // { // _healthPlanCriteriaTeamAssignmentRepository.DeleteAssignmentsForCriteria(model.Id); // } //} _healthPlanCallQueueCriteriaService.SaveHealthPlanCallQueueCriteria(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, false); ModelState.Clear(); model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Criteria for healthplan and call queue created successfully"); } } return(RedirectToAction("ManageCriteria")); } catch (Exception ex) { model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message); return(View(model)); } }
public void PollForReportGeneration() { var healthPlans = !_healthPlanIds.IsNullOrEmpty() ? _corporateAccountRepository.GetByIds(_healthPlanIds) : _corporateAccountRepository.GetAllHealthPlan(); var callQueue = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.MailRound); var collection = new List <GmsCallQueueCustomerViewModel>(); foreach (var healthPlan in healthPlans) { if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount) { break; } _logger.Info(string.Format("Getting call queue customers for Account ID : {0} and Tag : {1}", healthPlan.Id, healthPlan.Tag)); var criterias = _healthPlanCallQueueCriteriaRepository.GetCriteriaByHealthPlanCallQueue(healthPlan.Id, HealthPlanCallQueueCategory.MailRound); if (!_settings.GmsCampaignIds.IsNullOrEmpty()) { criterias = _healthPlanCallQueueCriteriaRepository.GetByCampaignIds(_settings.GmsCampaignIds, healthPlan.Id); _logger.Info(string.Format("Found {0} criterias for Campaign IDs : ", criterias.Count(), string.Join(",", _settings.GmsCampaignIds))); } foreach (var criteria in criterias) { if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount) { break; } _logger.Info(string.Format("Criteria ID : {0}", criteria.Id)); try { var filter = new OutboundCallQueueFilter { CallQueueId = callQueue.Id, CriteriaId = criteria.Id, CampaignId = criteria.CampaignId, Tag = healthPlan.Tag, HealthPlanId = healthPlan.Id, UseCustomTagExclusively = false }; if (filter.HealthPlanId == _settings.OptumUtAccountId) { filter.CustomCorporateTag = _settings.OptumUtCustomTagsForGms; } else if (filter.HealthPlanId == 1083) { filter.CustomCorporateTag = "UHC-TX_GMS_2018_List-1"; } else if (filter.HealthPlanId == 1066) { filter.CustomCorporateTag = "Excellus_GMS_2018_List-1"; } else if (filter.HealthPlanId == 1061) { filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-1_GMS,Optum-NV_Assessments_2018_List-2_GMS,Optum-NV_Assessments_2018_List-3_GMS,Optum-NV_Mammo_2018_List-2_GMS"; } else if (filter.HealthPlanId == 1111) { filter.CustomCorporateTag = "Optum-NV_Assessments_2018_List-4_GMS"; } else if (filter.HealthPlanId == 1087) { filter.CustomCorporateTag = "UHC-AZ_Assessments_2018_List-1_GMS"; } else if (filter.HealthPlanId == 1093) { filter.CustomCorporateTag = "UHC-CT_Assessments_2018_List-1_GMS"; } _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(filter); var dataGen = new ExportableDataGenerator <GmsCallQueueCustomerViewModel, OutboundCallQueueFilter>(_callQueueCustomerReportService.GetGmsCallQueueCustomersReport, _logger); var model = dataGen.GetData(filter); var distinctCustomers = model.Collection.Where(x => !collection.Select(c => c.CustomerId).Contains(x.CustomerId)); collection.AddRange(distinctCustomers); } catch (Exception ex) { _logger.Error("Error getting call queue customers for Account ID : " + healthPlan.Id + " Criteria ID : " + criteria.Id); _logger.Error(ex); } } } if (!collection.Any()) { _logger.Info("No records found."); return; } if (_settings.GmsMaxCustomerCount > 0 && collection.Count() >= _settings.GmsMaxCustomerCount) { collection = collection.Take(_settings.GmsMaxCustomerCount).ToList(); } if (!Directory.Exists(_settings.GmsCustomerReportPath)) { Directory.CreateDirectory(_settings.GmsCustomerReportPath); } var fileName = _settings.GmsCustomerReportPath + @"\" + string.Format("PatientList_{0}.csv", DateTime.Today.ToString("yyyyMMdd")); WriteCsv(collection, fileName); if (_settings.SendReportToGmsSftp) { _logger.Info("Sending Customer List to GMS sftp."); var sftpFolderReportDirectory = _settings.GmsSftpPath; var processFtp = new ProcessFtp(_logger, _settings.GmsSftpHost, _settings.GmsSftpUserName, _settings.GmsSftpPassword); processFtp.UploadSingleFile(fileName, sftpFolderReportDirectory, ""); _logger.Info("Sent Customer List to GMS sftp."); } else { _logger.Info("Setting to send Customer list to sftp is OFF."); } }