예제 #1
0
        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();
            }
        }
예제 #2
0
        private void RatedEmployees_Load(object sender, EventArgs e)
        {
            JobController jobController = new JobController();
            var           jobs          = jobController.GetJobs().Where(x => x.Employer_Id == _myId).ToList();

            ProfileController profileController = new ProfileController();

            EmployerController empController = new EmployerController();
            var rates = empController.Select(_myId).EmployerRates;

            var result = from job in jobs
                         join rate in rates on new { cont1 = job.Employer_Id, cont2 = job.Id } equals new { cont1 = rate.Employer_Id, cont2 = rate.Job_Id }
            select new RatedEmployeesData
            {
                Position       = job.Position,
                YourRate       = new RatedEmployeesData().GetImage(rate.Rate),
                JobSeekersRate = new RatedEmployeesData().SetCompanysRate(job.Id, rate.JobSeeker_Id),
                JobSeekersName = profileController.Select(rate.JobSeeker_Id).FirstName
            };

            dataGridView1.DataSource = result.ToList();
        }