private OutboundCallQueueListModel OutboundCallQueueListModel(IEnumerable <CallQueueCustomer> callQueueCustomers, string customerTags) { var customerIds = callQueueCustomers.Where(cqc => cqc.CustomerId.HasValue && cqc.CustomerId.Value > 0).Select(cqc => cqc.CustomerId.Value).ToArray(); IEnumerable <Customer> customers = null; if (customerIds.Any()) { customerIds = customerIds.Distinct().ToArray(); customers = _customerRepository.GetCustomers(customerIds); } var prospectCustomers = _prospectCustomerRepository.GetProspectCustomersByCustomerIds(customerIds); var callQueueCustomerCalls = _callCenterCallRepository.GetCallForHealtPlanCallQueueCustomer(customerIds, customerTags); IEnumerable <CallCenterNotes> callCenterNotes = null; if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any()) { callCenterNotes = _callCenterNotesRepository.GetByCallIds(callQueueCustomerCalls.Select(s => s.CallId)); } var corporateCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); return(_outboundCallQueueListModelFactory.SystemGeneratedCallQueueCustomers(callQueueCustomers, customers, prospectCustomers, callQueueCustomerCalls, callCenterNotes, null, null, corporateCustomTags)); }
public OutboundCallQueueListModel GetOutboundCallQueueListModel(OutboundCallQueueFilter filter, CallQueue callQueue, int pageSize, long criteriaId, out int totalRecords) { IEnumerable <CallQueueCustomer> callQueueCustomers; if (callQueue.Category == CallQueueCategory.FillEvents) { callQueueCustomers = _callQueueCustomerRepository.GetCallQueueCustomerForFillEvents(filter, filter.PageNumber, pageSize, criteriaId, out totalRecords); } else { callQueueCustomers = _callQueueCustomerRepository.GetCallQueueCustomerForZipCode(filter, filter.PageNumber, pageSize, out totalRecords); } if (callQueueCustomers.IsNullOrEmpty()) { return(null); } var customerIds = callQueueCustomers.Where(cqc => cqc.CustomerId.HasValue && cqc.CustomerId.Value > 0).Select(cqc => cqc.CustomerId.Value).ToArray(); IEnumerable <Customer> customers = null; if (customerIds.Any()) { customerIds = customerIds.Distinct().ToArray(); customers = _customerRepository.GetCustomers(customerIds); } var prospectCustomerIds = callQueueCustomers.Where(cqc => cqc.ProspectCustomerId.HasValue && cqc.ProspectCustomerId.Value > 0).Select(cqc => cqc.ProspectCustomerId.Value).Distinct().ToArray();//&& !cqc.CustomerId.HasValue var prospectCustomers = _prospectCustomerRepository.GetProspectCustomers(prospectCustomerIds); var callQueueCustomerCalls = _callCenterCallRepository.GetCallForCallQueueCustomerList(customerIds, prospectCustomerIds); IEnumerable <CallCenterNotes> callCenterNotes = null; if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any()) { callCenterNotes = _callCenterNotesRepository.GetByCallIds(callQueueCustomerCalls.Select(s => s.CallId)); } return(_outboundCallQueueListModelFactory.SystemGeneratedCallQueueCustomers(callQueueCustomers, customers, prospectCustomers, callQueueCustomerCalls, callCenterNotes, null, null, null)); }