public ActionResult Reject(int?id, JobRequisition requisition) { if (id == null) { return(View("Error")); } try { JobRequisition jobRequisition; using (var db = new TalentContext()) { jobRequisition = db.JobRequisitions.Find(id); if (string.IsNullOrEmpty(jobRequisition.RequisitionNo)) { var req = new TalentContext().JobRequisitions.Count(); jobRequisition.RequisitionNo = "TR" + String.Format("{0:D6}", req + 1); } jobRequisition.RejectionNote = requisition.RejectionNote; jobRequisition.Status = JobRequisition.JobRequisitionStatus.Rejected; db.Entry(jobRequisition).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.Message = "Action Successful"; return(RedirectToAction("Requisitions", "Admin")); } } catch (Exception ex) { return(View("Error")); } }
public ActionResult MatchSkill(int?id, string details, string filter) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Include("Skills").Where(x => x.JobRequisitionID == id).First(); if (jobRequisition == null) { return(HttpNotFound()); } ViewBag.MatchedApplicants = new List <MatchedApplicant>(); if (jobRequisition.MatchedApplicants.Count() > 0) { ViewBag.MatchedApplicants = db.MatchedApplicants.Include("JobSeeker").Where(x => x.JobRequisitionID == id).ToList(); } ViewBag.Filter = filter; ViewBag.RequisitionID = jobRequisition.JobRequisitionID; return(View(jobRequisition)); } catch (Exception ex) { return(View("Error")); } }
private void createOfficePositions() { TalentContext context = new TalentContext(); for (int i = 1; i <= 5; i++) { var job = context.OfficePositions.Find(i); var requisition = new JobRequisition() { JobRequisitionID = i, HeadOfDepartmentID = 1, HumanResourcePersonnelID = 2, JobTitle = job.Title, JobDescription = job.RoleSummary, PublishedDate = DateTime.Now, StartDate = DateTime.Now.AddDays(i), ClosingDate = DateTime.Now.AddDays(14), Location = "Lagos", Status = JobRequisition.JobRequisitionStatus.Posted, NoOfPositionsAvailable = 1, OfficePositionID = job.OfficePositionID }; context.JobRequisitions.Add(requisition); } // context.SaveChanges(); }
public ActionResult VerifyMatchedApplicant(int?id, int?applicantid, string details, string filter) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (applicantid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Include("Skills").Where(x => x.JobRequisitionID == id).First(); if (jobRequisition == null) { return(HttpNotFound()); } JobSeeker applicant = db.Applicants.Include("skills").Where(x => x.ID == applicantid).First(); if (applicant == null) { return(HttpNotFound()); } ViewBag.applicantid = applicantid; ViewBag.Applicant = applicant; ViewBag.RequisitionID = jobRequisition.JobRequisitionID; return(View(jobRequisition)); } catch (Exception ex) { return(View("Error")); } }
public ActionResult DeleteConfirmed(int id) { JobRequisition jobRequisition = db.JobRequisitions.Find(id); db.JobRequisitions.Remove(jobRequisition); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Apply(int id,JobSeeker jobseeker) { if (id == 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } JobRequisition job = db.JobRequisitions.Find(id); ViewBag.Industries = db.Industries.ToList(); ViewBag.jobRequisition = job; if (job == null) { return HttpNotFound(); } try { //get the details of the applicant var IsProfileCompleted = checkalluserfields(); var IsApplicationExisting = checkIfApplicationExists(User.Identity.GetUserId(),id); if (IsApplicationExisting) { ViewBag.Message = "FoundApplication"; return View(jobseeker); } if (IsProfileCompleted) { //run check to see if there is an existing application with the clientid and job requisitionid //Display Message to indicate Success //Create new Job Application var application = new JobApplication(); application.ApplicationStatus = ApplicationStatus.Applied; application.JobSeekerID = getuserid(); application.RegistrationDate = DateTime.Now; application.JobRequisitionID = id; using(var db=new TalentContext()) { db.JobApplications.Add(application); db.SaveChanges(); } ViewBag.Message = "True"; } else { ViewBag.Message = "False"; } //Obtain List of Fields to be Updated //Display Message to indicate Success return View(jobseeker); } catch { ViewBag.Message = "Please Re-Apply"; return View(jobseeker); } }
public ActionResult Edit(int?id, JobRequisition requisition, List <CheckModel> checks) { ViewBag.Message = "Changes Were Not Saved. Pls Try Again"; if (!ModelState.IsValid) { return(View(requisition)); } try { //List<Skill> selectedskills = checks.Where(x => x.Checked == true) // .Select(o => new Skill { ID = o.Id, Name = o.Name }).ToList(); //var selectedint = selectedskills.Select(o => o.ID).ToList(); using (var db = new TalentContext()) { JobRequisition jobRequisition = db.JobRequisitions.Find(id); if (string.IsNullOrEmpty(jobRequisition.RequisitionNo)) { var req = new TalentContext().JobRequisitions.Count(); jobRequisition.RequisitionNo = "TR" + String.Format("{0:D6}", req + 1); } jobRequisition.JobResponsibilities = requisition.JobResponsibilities; jobRequisition.EducationalRequirements = requisition.EducationalRequirements; jobRequisition.AgeLimit = requisition.AgeLimit; jobRequisition.JobDescription = jobRequisition.JobDescription; jobRequisition.Location = requisition.Location; jobRequisition.ClosingDate = requisition.ClosingDate; jobRequisition.StartDate = requisition.StartDate; jobRequisition.YearsOfExperience = requisition.YearsOfExperience; jobRequisition.NoOfPositionsAvailable = requisition.NoOfPositionsAvailable; jobRequisition.Status = JobRequisition.JobRequisitionStatus.Created; jobRequisition.PublishedDate = DateTime.Now; db.Entry(jobRequisition).State = System.Data.Entity.EntityState.Modified; //var skills = db.Skills // .Where(x => selectedint.Contains(x.ID)) // .ToList(); // db.JobRequisitions.Add(requisition); //jobRequisition.Skills.Clear(); //jobRequisition.Skills = selectedskills; db.SaveChanges(); //requisition.Skills.Union(skills); //requisition.Skills.Intersect(skills); //requisition.Skills = skills; // db.SaveChanges(); ViewBag.Message = "Changes Were succesfully Saved"; return(RedirectToAction("Requisitions", "Admin")); //return View(requisition); } } catch { //return; return(View("Error")); } }
public ActionResult Create(JobRequisition requisition, List <CheckModel> checks) { var req = new TalentContext().JobRequisitions.Count(); requisition.RequisitionNo = "TR" + String.Format("{0:D6}", req + 1); if (DateTime.Now.Year > requisition.StartDate.Year) { ViewBag.Message = "Invalid Start Date for Requisition"; //ViewBag.Message = requisition.StartDate + " " + requisition.ClosingDate+ " " + requisition.PublishedDate; return(View(requisition)); } if (DateTime.Now.Year > requisition.ClosingDate.Year) { ViewBag.Message = "Invalid Closing Date for Requisition"; //ViewBag.Message = requisition.StartDate + " " + requisition.ClosingDate+ " " + requisition.PublishedDate; return(View(requisition)); } if (!ModelState.IsValid) { ViewBag.Message = "Couldn't Create Requisition; Form was not Completed Properly"; return(View(requisition)); } try { List <Skill> selectedskills = checks.Where(x => x.Checked == true) .Select(o => new Skill { ID = o.Id, Name = o.Name }).ToList(); var selectedint = selectedskills.Select(o => o.ID).ToList(); requisition.Status = JobRequisition.JobRequisitionStatus.Created; //requisition.StartDate = DateTime.UtcNow; //requisition.ClosingDate = DateTime.UtcNow; requisition.PublishedDate = DateTime.UtcNow; using (var db = new TalentContext()) { var skills = db.Skills .Where(x => selectedint.Contains(x.ID)) .ToList(); db.JobRequisitions.Add(requisition); db.SaveChanges(); requisition.Skills.Union(skills); requisition.Skills.Intersect(skills); requisition.Skills = skills; db.SaveChanges(); } ViewBag.Message = "Successfully Created Requisition"; return(View()); } catch { return(View("Error")); } }
public ActionResult _GetRequisition(int?id) { var requisition = new JobRequisition(); using (var db = new TalentContext()) { requisition = db.JobRequisitions.Find(id); } return(PartialView(requisition)); }
public ActionResult Edit([Bind(Include = "JobRequisitionID,JobTitle,Status,NoOfPositionsAvailable,JobDescription,HumanResourcePersonnelID,HeadOfDepartmentID,StartDate,ClosingDate,JobUrl")] JobRequisition jobRequisition) { if (ModelState.IsValid) { db.Entry(jobRequisition).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(jobRequisition)); }
public ActionResult _GetSkills(int?id) { var user = new JobRequisition(); var sk = new List <CheckModel>(); using (var db = new TalentContext()) { if (id == null) { // ViewBag.Skills = db.Skills.ToList(); var ag = db.Skills .GroupBy(o => o.Name) .Select(x => x.FirstOrDefault()).ToList(); var bg = ag.SkipWhile(x => x.Name.Count() > 1); ViewBag.Skills = ag; var list = new List <CheckModel>(); foreach (var item in (List <Skill>)ViewBag.Skills) { list.Add(new CheckModel { Id = item.ID, Name = item.Name, Checked = false }); } ViewBag.SelectedSkills = list; sk = list; } else { user = db.JobRequisitions.Include("Skills").Where(s => s.JobRequisitionID == id).FirstOrDefault(); var ag = db.Skills .GroupBy(o => o.Name) .Select(x => x.FirstOrDefault()).ToList(); var bg = ag.SkipWhile(x => x.Name.Count() > 1); ViewBag.Skills = ag; var list = new List <CheckModel>(); foreach (var item in (List <Skill>)ViewBag.Skills) { if (user.Skills.Contains(item)) { list.Add(new CheckModel { Id = item.ID, Name = item.Name, Checked = true }); } else { list.Add(new CheckModel { Id = item.ID, Name = item.Name, Checked = false }); } } ViewBag.SelectedSkills = list; sk = list; } } return(PartialView("_GetSkills", sk)); }
// GET: Job/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobRequisition jobRequisition = db.JobRequisitions.Find(id); if (jobRequisition == null) { return(HttpNotFound()); } return(View(jobRequisition)); }
public ActionResult _GetDetailsFromRole() { var job = new JobRequisition(); using (var db = new TalentContext()) { ViewBag.Departments = db.Departments.ToList(); ViewBag.Positions = Enumerable.Empty <SelectListItem>(); var req = db.JobRequisitions.Count(); job.RequisitionNo = "TR" + String.Format("{0:D6}", req + 1); } // var numgen = new Random(); return(PartialView(job)); }
public ActionResult Reject(int?id, JobRequisition requisition) { JobRequisition jobRequisition; using (var db = new TalentContext()) { jobRequisition = db.JobRequisitions.Find(id); jobRequisition.RejectionNote = requisition.RejectionNote; jobRequisition.Status = JobRequisition.JobRequisitionStatus.Rejected; db.Entry(jobRequisition).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.Message = "Action Successful"; } return(View()); }
public PartialViewResult _GetJobPost(JobRequisition job) { //JobRequisition job = new JobRequisition(); //using(var db=new TalentContext()) // { // int id = job.JobRequisitionID; // //ViewBag.Location = "Lagos"; // //ViewBag.Industry = from s in db.Industries // // join ka in db.OfficePositions // // on s.IndustryId equals ka.IndustryID // // join b in db.JobRequisitions on // // ka.Title equals b.JobTitle // // select s.Name; // } return(PartialView("JobPost", job)); }
public ActionResult Close(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Find(id); if (jobRequisition == null) { return(HttpNotFound()); } ViewBag.RequisitionID = jobRequisition.JobRequisitionID; return(View(jobRequisition)); }
public ActionResult Approve(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Include("Skills").Where(x => x.JobRequisitionID == id).First(); if (jobRequisition == null) { return(HttpNotFound()); } ViewBag.RequisitionID = jobRequisition.JobRequisitionID; return(View(jobRequisition)); }
private List <JobApplication> MatchingTheCandidatesWithApplicationAlgorithm(int?id) { //var matchedApplicants = new List<JobSeeker>(); var matchedApplications = new List <JobApplication>(); var requisition = new JobRequisition(); using (var db = new TalentContext()) { // var Applications = ApplicationsForRequisition(id, db); var Applications = db.JobApplications.Include("JobSeeker.Skills").Where(job => job.JobRequisitionID == id && job.ApplicationStatus == ApplicationStatus.Applied).ToList(); requisition = db.JobRequisitions.Find(id); //matchedApplicants = CheckApplicationsForMatch(requisition, Applications); matchedApplications = CheckApplicationsForMatch(requisition, Applications); } /// return matchedApplicants; return(matchedApplications); }
public ActionResult Approve(int id) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Find(id); if (jobRequisition == null) { return(HttpNotFound()); } jobRequisition.Status = JobRequisition.JobRequisitionStatus.Approved; db.Entry(jobRequisition).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.Message = "Job Successfully Published"; return(RedirectToAction("Requisitions", "Admin")); }
public ActionResult Details(int? id) { try { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } JobRequisition jobRequisition = db.JobRequisitions.Find(id); if (jobRequisition == null) { return HttpNotFound(); } return View(jobRequisition); } catch { return View("Error"); } }
private List <JobSeeker> CheckApplicantsForMatch(JobRequisition requisition, List <JobSeeker> allApplicants) { var matchedApplicants = new List <JobSeeker>(); // var matchedApplications = new List<JobApplication>(); //var allApplicants = new List<JobSeeker>(); int _passed = 0, _failed; foreach (var mit in allApplicants) { _passed = 0; _failed = 0; ComparisonOne(ref _passed, ref _failed, requisition.Skills, mit.Skills); ComparisonTwo(ref _passed, ref _failed, requisition.MinimumQualification, requisition.HighestQualification, mit.HighestQualification); ComparisonThree(ref _passed, ref _failed, requisition.AgeLimit, mit.Age); if (_passed >= 2) { matchedApplicants.Add(mit); } } return(matchedApplicants); }
private List <JobSeeker> MatchingTheCandidatesAlgorithm(int id) { var matchedApplicants = new List <JobSeeker>(); var requisition = new JobRequisition(); //var db = new TalentContext(); using (var db = new TalentContext()) { requisition = db.JobRequisitions.Include("OfficePosition").Where(o => o.JobRequisitionID == id).FirstOrDefault(); var jbk = db.JobApplications.Include("JobSeeker") .Where(x => x.JobRequisitionID == id).Select(x => x.JobSeeker).ToList(); matchedApplicants = db.Applicants.Include("Skills").ToList(); foreach (var jb in jbk) { matchedApplicants.Remove(jb); } matchedApplicants = CheckApplicantsForMatch(requisition, matchedApplicants); } return(matchedApplicants); }
public ActionResult Apply(int id) { if (id == 0) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } JobRequisition job = db.JobRequisitions.Find(id); ViewBag.jobRequisition = job; ViewBag.Industries = db.Industries.ToList(); if (job == null) { return HttpNotFound(); } var jobseekerguid = User.Identity.GetUserId(); JobSeeker applicant = db.Applicants.Where(o => o.UserId == jobseekerguid) .Include("JobApplications") .Include("Schools") .Include("WorkExperiences") .Include("Certifications").FirstOrDefault(); return View(applicant); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TalentContext db = new TalentContext(); JobRequisition jobRequisition = db.JobRequisitions.Include("Skills").Where(x => x.JobRequisitionID == id).First(); if (jobRequisition == null) { return(HttpNotFound()); } if (string.IsNullOrEmpty(jobRequisition.RequisitionNo)) { var req = new TalentContext().JobRequisitions.Count(); jobRequisition.RequisitionNo = "TR" + String.Format("{0:D6}", req + 1); } ViewBag.RequisitionID = jobRequisition.JobRequisitionID; ViewBag.Departments = db.Departments.ToList(); ViewBag.Industries = db.Departments.ToList(); return(View(jobRequisition)); }
public ActionResult Apply(int id) { try { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } JobRequisition job = db.JobRequisitions.Find(id); if (job == null) { return(HttpNotFound()); } var application = new JobApplication(); //get the details of the applicant var IsProfileCompleted = checkalluserfields(); if (IsProfileCompleted) { //Display Message to indicate Success try { } catch { } //Create new Job Application } //Obtain List of Fields to be Updated //Display Message to indicate Success return(View()); } catch { return(View("Error")); } }