public ActionResult FillEventCallQueue([FromUri] FillEventsCallQueueFilter filter, int pageNumber = 1) { int totalRecords; var model = _eventService.GetEventBasicInfoForCallQueueReport(filter, _pageSize, out totalRecords) ?? new FillEventCallQueueModel { Filter = filter }; var account = _organizationRepository.GetOrganizationbyId(filter.HealthPlanId); model.HealthPlanName = account.Name; var currentAction = ControllerContext.RouteData.Values["action"].ToString(); Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.CallQueueId, filter.CriteriaId, filter.HealthPlanId, filter.EventId, }); model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc); return(View(model)); }
public EventBasicInfoListModel GetEventsForFillEventHealthPlan([FromUri] FillEventsCallQueueFilter filter) { int totalRecords; filter.AssignedToOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; var model = _eventService.GetEventBasicInfoForCallQueue(filter, PageSize, out totalRecords) ?? new EventBasicInfoListModel(); model.PagingModel = new PagingModel(filter.PageNumber, PageSize, totalRecords, null); return(model); }
public EventBasicInfoListModel GetEventBasicInfoForCallQueue(FillEventsCallQueueFilter filter, int pageSize, out int totalRecords) { var criteria = _healthPlanCallQueueCriteriaService.GetSystemGeneratedCallQueueCriteria(filter.CallQueueId, filter.HealthPlanId, filter.AssignedToOrgRoleUserId, 0, filter.CriteriaId); if (criteria != null && criteria.IsQueueGenerated == false) { throw new Exception("Please wait for 10 minutes(max) after you have changed the criteria so that the queue is regenerated."); } var events = _eventRepository.GetHealthPlanEventsForCallQueue(filter, criteria.Id); if (events == null || !events.Any()) { totalRecords = 0; return(null); } var endDate = DateTime.Today.AddDays(criteria.NoOfDays); events = events.Where(x => x.EventDate.Date <= endDate.Date); var outboundCallQueueFilter = new OutboundCallQueueFilter { CallQueueId = criteria.CallQueueId, CriteriaId = criteria.Id, HealthPlanId = criteria.HealthPlanId ?? 0, Radius = 25, GmsAccountIds = _settings.GmsAccountIds }; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(outboundCallQueueFilter); var eventIdsWithCustomers = _callQueueCustomerRepository.GetHealthPlanEventsForCriteria(outboundCallQueueFilter); events = events.Where(x => (eventIdsWithCustomers.IsNullOrEmpty() || eventIdsWithCustomers.Contains(x.Id))); events = _fillEventsCallQueueHelper.GetAllTheEventFilledUnderPecentage(events, criteria.Percentage); totalRecords = events.Count(); events = events.OrderBy(ev => ev.EventDate).Skip((filter.PageNumber - 1) * pageSize).Take(pageSize); var eventList = _eventCallQueueHelper.EventBasicInfoListForCallQueue(events); return(eventList); }
public FillEventCallQueueModel GetEventBasicInfoForCallQueueReport(FillEventsCallQueueFilter filter, int pageSize, out int totalRecords) { var criteria = _healthPlanCallQueueCriteriaRepository.GetById(filter.CriteriaId); if (criteria != null && criteria.IsQueueGenerated == false) { totalRecords = 0; return(new FillEventCallQueueModel { Filter = filter, IsQueueGenerated = false, CallQueueCriteria = criteria }); } var callQueueId = filter.CallQueueId; filter.CallQueueId = criteria.CallQueueId; var events = _eventRepository.GetHealthPlanEventsForCallQueue(filter, criteria.Id); if (events == null || !events.Any()) { totalRecords = 0; return(null); } var endDate = DateTime.Today.AddDays(criteria.NoOfDays); events = events.Where(x => x.EventDate.Date <= endDate.Date); events = _fillEventsCallQueueHelper.GetAllTheEventFilledUnderPecentage(events, criteria.Percentage); var outboundCallQueueFilter = new OutboundCallQueueFilter { CallQueueId = criteria.CallQueueId, CriteriaId = criteria.Id, HealthPlanId = criteria.HealthPlanId ?? 0, Radius = 25, GmsAccountIds = _settings.GmsAccountIds }; _healthPlanOutboundCallQueueService.GetAccountCallQueueSettingForCallQueue(outboundCallQueueFilter); var eventIdsWithCustomers = _callQueueCustomerRepository.GetHealthPlanEventsForCriteria(outboundCallQueueFilter); events = events.Where(x => (!eventIdsWithCustomers.IsNullOrEmpty() && eventIdsWithCustomers.Contains(x.Id))); totalRecords = events.Count(); events = events.OrderBy(ev => ev.EventDate).Skip((filter.PageNumber - 1) * pageSize).Take(pageSize); filter.CallQueueId = callQueueId; var model = _eventCallQueueHelper.EventBasicInfoListForCallQueue(events); if (model == null || model.Events.IsNullOrEmpty()) { return new FillEventCallQueueModel { Events = null, Filter = filter, IsQueueGenerated = true, CallQueueCriteria = criteria } } ; return(new FillEventCallQueueModel { Events = model.Events, Filter = filter, IsQueueGenerated = true, CallQueueCriteria = criteria }); } }