public ListModelBase <MailRoundCustomersReportViewModel, OutboundCallQueueFilter> GetCustomersForMatrixReport(int pageNumber, int pageSize, OutboundCallQueueFilter filter, CallQueue callQueue, out int totalRecords) { totalRecords = 0; MailRoundCustomersListModel model = null; IEnumerable <long> customerIds = null; if (callQueue.Category == HealthPlanCallQueueCategory.MailRound) { customerIds = _callQueueCustomerRepository.GetMailRoundCustomerIdsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords); } else if (callQueue.Category == HealthPlanCallQueueCategory.FillEventsHealthPlan) { customerIds = _callQueueCustomerRepository.GetFillEventCustomerIDsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords); } else if (callQueue.Category == HealthPlanCallQueueCategory.LanguageBarrier) { customerIds = _callQueueCustomerRepository.GetLanguageBarrierCustomerIDsForMatrixReport(filter, callQueue, pageNumber, pageSize, out totalRecords); } if (!customerIds.IsNullOrEmpty()) { var startOfYear = new DateTime(DateTime.Now.Year, 1, 1); var customers = _customerRepository.GetCustomers(customerIds.ToArray()); var directMails = _directMailRepository.GetByCustomerIds(customerIds, startOfYear); var callDetails = _callCenterCallRepository.GetCallsByCustomerIds(customerIds, fromDate: startOfYear, isOutbound: true); var customTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds, startOfYear); model = _mailRoundCustomersReportFactory.Create(customers, callDetails, directMails, customTags); } model = model ?? new MailRoundCustomersListModel(); model.Filter = filter; return(model); }