/// <summary> /// Change the information based on the URL information /// </summary> public override void changeURL() { int parseable; if (url.Contains("=")) profileId = Request.QueryString["profile"]; service = new MatchyService(); if (Int32.TryParse(profileId, out parseable)) { try { CvMapping mapping = new CvMapping(); Cv = mapping.mapFromService(service.GetCv(Convert.ToInt32(profileId))[0]); Session["CvObject"] = Cv; User newUser = (User)Session["UserObjectOwn"]; user.UserCv = Cv; newUser = (User)Session["UserObjectOwn"]; } catch { Response.Redirect("vacature.aspx?page=1"); } } else Response.Redirect("vacature.aspx?page=1"); }
/// <summary> /// Checks if all the fields were Valid and sends it to the service to add the user if valid. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Reg_Click(object sender, EventArgs e) { if (IsGroupValid(regButton.ValidationGroup)) { UserMapping mapping = new UserMapping(); User userRegister = new User(); UserCv cv = null; UserCompany company = null; userRegister.Email = regMail.Text; userRegister.Pass = regPassword.Text; userRegister.BirthDay = YearTemp.Text + "-" + MonthTemp.Text + "-" + DayTemp.Text; if (cv_companyRadio.SelectedValue.Equals("Particulier")) { cv = new UserCv(); cv.Name = regFN.Text + " " + regLN.Text; cv.Age = Convert.ToInt32(cvAgeDropDown.SelectedValue); cv.City = cvCity.Text; cv.Email = userRegister.Email; cv.Province = cvProvince.Text; cv.Sex = (cvSexOption.SelectedValue).Substring(0, 1); cv.Personal = cvPersonal.Text; cv.Interests = cvInterests.Text; Education educationLevel = new Education(); educationLevel.EducationId = Convert.ToInt32(cvEducationDropDown.SelectedValue); cv.EducationLevel = educationLevel; cv.EducationHistory = cvEducation.Text; cv.Hours = cvWorkTime.SelectedValue; cv.Profession = cvProfession.Text; cv.Discipline = cvDiscipline.Text; cv.JobRequirements = cvJobRequirements.Text; cv.WorkExperience = cvWorkExperience.Text; cv.Date = DateTime.Now.ToString(); Source source = new Source(); source.Description = "Geregistreerd"; cv.Source = source; userRegister.UserCv = cv; } else if (cv_companyRadio.SelectedValue.Equals("Bedrijf")) { company = new UserCompany(); company.CompanyName = companyName.Text; company.CompanyCity = companyCity.Text; company.CompanyEmail = companyEmail.Text; company.CompanyTel = companyPhone.Text; company.CompanyDescription = companyDescription.Text; company.CompanyDate = DateTime.Now.ToString(); userRegister.UserCompany = company; } try { int returnType = service.AddUser(mapping.mapToService(userRegister)); if (returnType == 0) { errorMessage.InnerHtml = "<span>De gebruiker kon niet aangemaakt worden probeer het later nog een keer</span>"; } else if (returnType == 1) { Response.Redirect("login.aspx?registration=done"); } else { errorMessage.InnerHtml = "<span>De gebruiker bestaat al</span>"; regMail.Style["border"] = "1px solid red"; } } catch (System.Net.WebException) { errorMessage.InnerHtml = "<span>Er kon geen verbinding gemaakt worden met de webservice<br />Probeer het later nog eens</span>"; } } }
/// <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"); }