Exemplo n.º 1
0
        public ListModelBase <CustomTestPerformedViewModel, CustomTestPerformedReportFilter> CustomTestPerformedReport(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords)
        {
            var eventCustomerResults = _eventCustomerRepository.GetEventCustomerResultByFilter(filter as CustomTestPerformedReportFilter, pageNumber, pageSize, out totalRecords);

            if (eventCustomerResults.IsNullOrEmpty())
            {
                return(null);
            }

            var eventCustomeResultIds       = eventCustomerResults.Select(x => x.EventCustomerId).ToArray();
            var customerEventScreeningTests = _eventCustomerResultRepository.GetCustomerEventScreeningTestsByEventCustomerResultIds(eventCustomeResultIds);

            var events    = _eventRepository.GetEventswithPodbyIds(eventCustomerResults.Select(ecr => ecr.EventId).Distinct().ToArray());
            var customers = _customerRepository.GetCustomers(eventCustomerResults.Select(ecr => ecr.CustomerId).Distinct().ToArray());
            var tests     = ((IUniqueItemRepository <Test>)_testRepository).GetByIds(customerEventScreeningTests.Select(ces => ces.TestId).Distinct().ToArray());

            return(_customTestPerformedListModelFactory.Create(eventCustomerResults, customerEventScreeningTests, events, customers, tests));
        }