private void register_btn_Click(object sender, EventArgs e) { if (employer_rdbtn.Checked) { Employer emp = new Employer() { Username = username_box.Text, Password = password_box.Text, Email = email_box.Text }; EmployerController empController = new EmployerController(); empController.Insert(emp); Dispose(); } else if (jobseeker_rdbtn.Checked) { JobSeeker jobSeeker = new JobSeeker() { Username = username_box.Text, Password = password_box.Text, Email = email_box.Text }; JobSeekerController jobSeekerController = new JobSeekerController(); jobSeekerController.Insert(jobSeeker); Dispose(); } else { MessageBox.Show("Please select a type"); } }
private void yes_btn_Click(object sender, EventArgs e) { if (_userType == Type.Employer) { EmployerRatesController rateController = new EmployerRatesController(); EmployerController employerController = new EmployerController(); Employer emp = employerController.Select(_myId); var jobs = _employerControl.Positions.Items; foreach (Job j in jobs) { EmployerRates rate = null; if (_employerControl.Positions.CheckedItems.Contains(j)) { rate = new EmployerRates() { Employer_Id = _myId, JobSeeker_Id = _jobSeeker.Id, Job_Id = j.Id, Rate = true }; } else { rate = new EmployerRates() { Employer_Id = _myId, JobSeeker_Id = _jobSeeker.Id, Job_Id = j.Id, Rate = false }; } rateController.Insert(rate); } ResetEmployerViewFields(); EmployersView(); } if (_userType == Type.JobSeeker) { JobSeekerRatesController rateController = new JobSeekerRatesController(); JobSeekerController jobSeekerController = new JobSeekerController(); JobSeeker jobSeeker = jobSeekerController.Select(_myId); JobSeekerRates rate = new JobSeekerRates() { JobSeeker_Id = _myId, Job_Id = _job.Id, Rate = true }; rateController.Insert(rate); ResetJobSeekerViewFields(); JobSeekersView(); } }
private void EmployersView() { try { EmployerRatesController empRatesContr = new EmployerRatesController(); while (empRatesContr.ExistsRate(_myId, _jobSeekers.Take(1).Single().Id)) { _jobSeekers = _jobSeekers.Skip(1).ToList(); } _jobSeeker = _jobSeekers.Take(1).Single(); _employerControl.JobSeekerName = string.Format("{0} {1}", _jobSeeker.Profile.FirstName, _jobSeeker.Profile.LastName); _employerControl.ContactData = _jobSeeker.Profile.ContactData; _employerControl.ShortDescription = _jobSeeker.Profile.ShortDescription; _employerControl.WorkExperience = _jobSeeker.Profile.WorkExperience; _employerControl.Education = _jobSeeker.Profile.Education; SkillController skillController = new SkillController(); var skills = skillController.GetSkills(_jobSeeker.Profile.JobSeeker_Id); foreach (Skill skill in skills) { _employerControl.Skills.Items.Add(new ListViewItem(skill.Skill1)); } JobController jobController = new JobController(); var jobs = jobController.GetJobs().Where(x => x.Employer_Id == _myId); foreach (Job j in jobs) { _employerControl.Positions.Items.Add(j); } _jobSeekers = _jobSeekers.Skip(1).ToList(); } catch (Exception ex) { Trace.WriteLine(ex.Message); MessageBox.Show("No more Job Seekers!"); Dispose(); } }