public void TestSearch() { Search searchObject = new Search(); SearchMapping searchMapping = new SearchMapping(); searchObject.City = "Rotterdam"; MatchyService service = new MatchyService(); MatchyBackend.Cv[] searchCompany = service.SearchByCompany(searchMapping.MapToService(searchObject)); if (searchCompany.Length > 0) Assert.Pass("Er zijn zoekresultaten."); else Assert.Pass("Er zijn geen zoekresultaten."); }
/// <summary> /// Gets the search values, which are entered by the user. /// </summary> /// <returns></returns> private Search getSearchValues() { Search search = new Search(); search.SearchTerm = searchTerm.Text.Equals("Zoekterm") ? null : searchTerm.Text; if (!searchEducation.Text.Equals("Default")) { search.Education = new Education(); search.Education.EducationId = Convert.ToInt32(searchEducation.SelectedValue); } search.City = searchCity.Text.Equals("Plaatsnaam") ? null : searchCity.Text; search.Hours = searchWorktime.Text.Equals("Default") ? null : searchWorktime.Text; if (!searchBranche.Text.Equals("Default")) { search.Branche = new Branche(); search.Branche.branche_ID = Convert.ToInt32(searchBranche.SelectedValue); } return search; }
/// <summary> /// Makes an search to the backend based on the information that is filled /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Search_Click(object sender, EventArgs e) { Search searchObject = new Search(); SearchMapping searchMapping = new SearchMapping(); searchObject = getSearchValues(); service = new MatchyService(); if (userOwn.UserCv.CvID != 0) { JobMapping jobMapping = new JobMapping(); MatchyBackend.Job[] searchEmployee = service.SearchByEmployee(searchMapping.MapToService(searchObject)); searchJobs = new Job[searchEmployee.Length]; for (int i = 0; i < searchEmployee.Length; i++) searchJobs[i] = jobMapping.mapFromService(searchEmployee[i]); Session["SearchList"] = searchJobs; } else if (userOwn.UserCompany.CompanyID != 0) { CvMapping cvMapping = new CvMapping(); MatchyBackend.Cv[] searchCompany = service.SearchByCompany(searchMapping.MapToService(searchObject)); searchCvs = new Cv[searchCompany.Length]; for (int i = 0; i < searchCompany.Length; i++) searchCvs[i] = cvMapping.mapFromService(searchCompany[i]); Session["SearchList"] = searchCvs; } Response.Redirect("zoekresultaten.aspx"); }