Пример #1
0
        public ActionResult shortListedCandidates(int?page, int?job_id, string searchkey = "")
        {
            int pageIndex;
            int emp_id = Convert.ToInt32(Session["emp_id"].ToString());

            pageIndex = page.HasValue ? Convert.ToInt16(page) : 1;
            int pageSize = 10;
            int userid   = Convert.ToInt32(Session["emp_id"].ToString());
            List <ShortListViewModel> show = new List <ShortListViewModel>();

            if (job_id.HasValue)
            {
                int job_id_ = Convert.ToInt16(job_id);
                var model   = (from data in db.applications
                               join js in db.jobseeker_info on data.jobseeker_id equals js.js_id
                               join jobs in db.jobs on data.job_id equals jobs.job_id
                               where jobs.employer == emp_id
                               where jobs.status == 1
                               where jobs.job_id == job_id_
                               where data.accept_status == 1
                               where data.status == 1
                               where js.full_name.Contains(searchkey) || jobs.title.Contains(searchkey)

                               select new
                {
                    app_id = data.app_id,
                    job = jobs.title,
                    jobseeker = js.full_name,
                    created_at = data.created_at,
                    status = data.status,
                    job_id = jobs.job_id,
                    jobseeker_id = js.js_id,
                    profile = js.profile,
                    age = js.dateofbirth,
                    location = js.current_address
                }
                               );
                foreach (var item in model)
                {
                    ShortListViewModel app = new ShortListViewModel();
                    app.app_id       = item.app_id;
                    app.job          = item.job;
                    app.jobseeker    = item.jobseeker;
                    app.jobseeker_id = item.jobseeker_id;
                    app.status       = item.status;
                    app.job_id       = item.job_id;
                    app.created_at   = item.created_at;
                    app.profile      = item.profile;
                    var temp = item.age;
                    if (temp != null)
                    {
                        DateTime now   = DateTime.Now;
                        TimeSpan t     = (now - Convert.ToDateTime(temp));
                        int      years = Convert.ToInt16(t.TotalDays) / 365;
                        app.age = years;
                    }
                    show.Add(app);
                }
            }
            else
            {
                var model_job_id = (from data in db.applications
                                    join js in db.jobseeker_info on data.jobseeker_id equals js.js_id
                                    join jobs in db.jobs on data.job_id equals jobs.job_id
                                    where jobs.employer == emp_id
                                    where jobs.status == 1
                                    where data.accept_status == 1
                                    where data.status == 1
                                    where js.full_name.Contains(searchkey) || jobs.title.Contains(searchkey)

                                    select new
                {
                    app_id = data.app_id,
                    job = jobs.title,
                    jobseeker = js.full_name,
                    created_at = data.created_at,
                    status = data.status,
                    job_id = jobs.job_id,
                    jobseeker_id = js.js_id,
                    profile = js.profile,
                    age = js.dateofbirth,
                    location = js.current_address
                }
                                    );
                foreach (var item in model_job_id)
                {
                    ShortListViewModel app = new ShortListViewModel();
                    app.app_id       = item.app_id;
                    app.job          = item.job;
                    app.jobseeker    = item.jobseeker;
                    app.jobseeker_id = item.jobseeker_id;
                    app.status       = item.status;
                    app.job_id       = item.job_id;
                    app.created_at   = item.created_at;
                    app.profile      = item.profile;
                    var temp = item.age;
                    if (temp != null)
                    {
                        DateTime now   = DateTime.Now;
                        TimeSpan t     = (now - Convert.ToDateTime(temp));
                        int      years = Convert.ToInt16(t.TotalDays) / 365;
                        app.age = years;
                    }
                    show.Add(app);
                }
            }

            return(View(show.ToPagedList(pageIndex, pageSize)));
        }
Пример #2
0
 public AccountsViewModel(ShortListViewModel shortListViewModel, DetailListViewModel detailListViewModel, TransfersViewModel transfersViewModel)
 {
     ShortListVm  = shortListViewModel;
     DetailListVm = detailListViewModel;
     TransfersVm  = transfersViewModel;
 }