private List <Entities.SubContractorDataItem> GetReadyToInvoiceForDates() { int identityID = 0; int.TryParse(cboSubContractor.SelectedValue, out identityID); // If all business types are selected then pass down an empty list - the stored procedure will then not filter on business type which will result in better performance var businessTypeIDs = chkBusinessType.AllBusinessTypesSelected ? Enumerable.Empty <int>() : chkBusinessType.SelectedBusinessTypeIDs; using (Facade.IJobSubContractor facJobSubContractor = new Facade.Job()) { return(facJobSubContractor.GetJobSubContractorsReadyToInvoice(rdiStartDate.SelectedDate, rdiEndDate.SelectedDate, identityID, businessTypeIDs)); } }