Example #1
0
        public void DoSearch()
        {
            //First, cast the List<JobLead> to an IEnumerable<JobLead>
            //as that is what the .Where(...) functions will work with
            //IEnumerable<JobLead> filteredJobLeads = JobGridData;
            JobLeadRepo           thisJobLeadRepo  = new JobLeadRepo();
            IEnumerable <JobLead> filteredJobLeads = thisJobLeadRepo.GetJobLeadGridDatasource();


            if (SearchJobTitleActive)
            {
                filteredJobLeads = thisJobLeadRepo.FilterByJobTitle(filteredJobLeads, SearchJobTitle);
            }

            if (SearchJobRefereneceActive)
            {
                filteredJobLeads = thisJobLeadRepo.FilterByJobReferenace(filteredJobLeads, SearchReferenceValue);
            }

            if (SearchAgencyNameActive)
            {
                filteredJobLeads = thisJobLeadRepo.FilterByAgency(filteredJobLeads, SearchAgencyName);
            }

            if (SearchEmployerNameActive)
            {
                filteredJobLeads = thisJobLeadRepo.FilterByEmployer(filteredJobLeads, SearchEmployerName);
            }

            if (SearchDateActive)
            {
                filteredJobLeads = thisJobLeadRepo.FilterByDate(filteredJobLeads, SearchStartDate, SearchEndDate);
            }

            //Finally, cast the IEnumerable<JobLead> back to a List<JobLead>
            JobGridData = filteredJobLeads.ToList();
        }