public JobLeadsViewModel() { JobLeadRepo thisJobLeadRepo = new JobLeadRepo(); try { JobGridData = thisJobLeadRepo.GetJobLeadGridDatasource(); AgencyBrokers = thisJobLeadRepo.GetBrokerGridDatasource().Where(m => m.IsAgency == true).ToList(); EmployerBrokers = thisJobLeadRepo.GetBrokerGridDatasource().Where(m => m.IsAgency == false).ToList(); } catch (Exception ex) { } //OpenJobLeadCommand = new RelayCommand(OpenJobLead); ExpandSearchCommand = new RelayCommand(ExpandSearch); DoSearchCommand = new RelayCommand(DoSearch); ShowAllLeadsCommand = new RelayCommand(ShowAllLeads); ClearSearchAgencyCommand = new RelayCommand(ClearSearchAgencyValue); ClearSearchEmployerCommand = new RelayCommand(ClearSearchEmployerValue); }
public void ShowAllLeads() { SearchDateActive = true; SearchJobTitleActive = true; SearchJobRefereneceActive = true; SearchAgencyNameActive = true; SearchEmployerNameActive = true; SearchAgencyName = ""; SearchEmployerName = ""; SearchEndDate = DateTime.Today; SearchStartDate = DateTime.Today; SearchJobTitle = ""; SearchReferenceValue = ""; JobLeadRepo thisJobLeadRepo = new JobLeadRepo(); JobGridData = thisJobLeadRepo.GetJobLeadGridDatasource(); }
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(); }