Beispiel #1
0
        public JsonResult CreateCandiateCode()
        {
            var msg = new JMessage()
            {
                Error = true
            };

            try
            {
                string code = "CAN_" + DateTime.Now.ToString("ddMMyyyy", CultureInfo.InvariantCulture) +
                              "_" + (_context.CandiateBasic.Count() > 0 ? (_context.CandiateBasic.OrderByDescending(x => x.Id).First().Id + 1).ToString() : 0.ToString());
                msg.Title = code;
                msg.Error = false;
                var candidate = new CandidateBasic()
                {
                    CandidateCode = code,
                    CreatedTime   = DateTime.Now,
                    //CreatedBy = ESEIM.AppContext.UserName
                };
                _context.CandiateBasic.Add(candidate);
                _context.SaveChanges();
                return(Json(msg));
            }
            catch (Exception ex)
            {
                msg.Object = ex;
                msg.Title  = "Có lỗi khi tạo mã!";
                return(Json(msg));
            }
        }
 public ActionResult EditProfile(CandidateBasic candidate)
 {
     if (ModelState.IsValid)
     {
         CandidateBasic candidateToBeUpdated = db.CandidateBasic.Find(candidate.candidateId);
         UpdateModel(candidateToBeUpdated);
         db.SaveChanges();
         return(RedirectToAction("JobSeekerProfile"));
     }
     return(View());
 }
        //[HttpGet]
        //public ActionResult NewExperience()
        //{
        //    string UserName = Session["UserName"].ToString();
        //    CandidateBasic candidateBasic = db.CandidateBasic.Single(c => c.username == UserName);
        //    ViewBag.CandidateId = candidateBasic.candidateId;
        //    ViewBag.industry = new SelectList(db.Categories, "category_id", "category_name");
        //    return View();
        //}

        //[HttpPost]
        //public ActionResult NewExperience(CandidateProfessional canditate)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        string UserName = Session["UserName"].ToString();
        //        CandidateBasic candidateBasic = db.CandidateBasic.Single(c => c.username == UserName);
        //        canditate.candidateId = candidateBasic.candidateId;
        //        int catId;
        //        catId = Convert.ToInt32(canditate.industry);
        //        var selectedIndustry = db.Categories.Single(i => i.category_id == catId);
        //        canditate.industry = selectedIndustry.category_name;
        //        db.CandidateProfessional.Add(canditate);
        //        db.SaveChanges();

        //        return RedirectToAction("ExperienceList", new { candidateId = canditate.candidateId });
        //    }

        //    ViewBag.industry = new SelectList(db.Categories, "category_id", "category_name");
        //    return View();
        //}

        public ActionResult JobSeekerProfile()
        {
            if (Session["UserName"] == null)
            {
                Session["UserName"] = "******";
                Session["UserRole"] = "jobseeker";
            }
            string         UserName       = Session["UserName"].ToString();
            CandidateBasic candidateBasic = new CandidateBasic();

            candidateBasic = db.CandidateBasic.Single(c => c.username == UserName);
            return(View(candidateBasic));
        }
 public ActionResult UploadResume(HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         if (file.ContentLength > 0)
         {
             string fileExtension = Path.GetExtension(file.FileName);
             if (fileExtension.ToLower() == ".doc" || fileExtension.ToLower() == ".docx" ||
                 fileExtension.ToLower() == ".pdf")
             {
                 string _FileName = Path.GetFileName(file.FileName);
                 string _Path     = Path.Combine(Server.MapPath("~/Resumes"), _FileName);
                 file.SaveAs(_Path);
                 ViewBag.Message = "Resume uploaded successfully!!";
                 CandidateBasic cb          = new CandidateBasic();
                 string         currentUser = Session["UserName"].ToString();
                 cb = db.CandidateBasic.Single(c => c.username == currentUser);
                 if (!string.IsNullOrEmpty(cb.resumePath))
                 {
                     if (System.IO.File.Exists(Server.MapPath(cb.resumePath)))
                     {
                         System.IO.File.Delete(Server.MapPath(cb.resumePath));
                     }
                 }
                 cb.resumePath      = "~/Resumes/" + _FileName;
                 db.Entry(cb).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
             }
             else
             {
                 ViewBag.Message = "Only doc, docx or pdf allowed";
             }
         }
         else
         {
             ViewBag.Message = "Upload failed";
         }
     }
     return(View());
 }
Beispiel #5
0
        public ActionResult NewJobSeeker(JobSeeker jobSeeker)
        {
            if (ModelState.IsValid)
            {
                //insert into users - populate user fields
                User newUser = new User();
                newUser.username = jobSeeker.username;
                newUser.password = jobSeeker.password;
                newUser.role     = "jobseeker";
                db.Users.Add(newUser);
                db.SaveChanges();

                //insert into Candidate Basic
                CandidateBasic candidateBasic = new CandidateBasic();
                //code to copy data from jobSeeker to candidateBasic
                candidateBasic.username      = jobSeeker.username;
                candidateBasic.quesId        = jobSeeker.Question;
                candidateBasic.ansr          = jobSeeker.Answer;
                candidateBasic.profileDate   = System.DateTime.Now;
                candidateBasic.firstName     = jobSeeker.firstName;
                candidateBasic.lastName      = jobSeeker.lastName;
                candidateBasic.candidateAddr = jobSeeker.candidateAddr;
                candidateBasic.city          = jobSeeker.city;
                candidateBasic.gender        = jobSeeker.gender;
                candidateBasic.dob           = jobSeeker.dob;
                candidateBasic.contactNo     = jobSeeker.contactNo;
                candidateBasic.emailId       = jobSeeker.emailId;
                db.CandidateBasic.Add(candidateBasic);
                int newCandidateId = candidateBasic.candidateId;

                //insert into Candidate Education
                CandidateEducation candidateEducation = new CandidateEducation();
                //code to copy data from jobSeeker to candidateEducation
                candidateEducation.candidateId        = newCandidateId;
                candidateEducation.aLevelSubject1     = jobSeeker.aLevelSubject1;
                candidateEducation.aLevelSubject2     = jobSeeker.aLevelSubject2;
                candidateEducation.aLevelSubject3     = jobSeeker.aLevelSubject3;
                candidateEducation.aLevelGrade1       = jobSeeker.aLevelGrade1;
                candidateEducation.aLevelGrade2       = jobSeeker.aLevelGrade2;
                candidateEducation.aLevelGrade3       = jobSeeker.aLevelGrade3;
                candidateEducation.graduation         = jobSeeker.graduation;
                candidateEducation.instituteGrad      = jobSeeker.instituteGrad;
                candidateEducation.percentageGrad     = jobSeeker.percentageGrad;
                candidateEducation.postGrad           = jobSeeker.postGrad;
                candidateEducation.institutePostGrad  = jobSeeker.institutePostGrad;
                candidateEducation.percentagePostGrad = jobSeeker.percentagePostGrad;
                candidateEducation.certification      = jobSeeker.certification;
                db.CandidateEducation.Add(candidateEducation);

                //insert into Candidate Profiessional
                CandidateProfessional candidateProfessional = new CandidateProfessional();
                //code to copy data from jobSeeker to candidateProfessional
                candidateProfessional.candidateId = newCandidateId;
                int catId;
                catId = Convert.ToInt32(jobSeeker.industry);
                var selectedIndustry = db.Categories.Single(i => i.category_id == catId);
                candidateProfessional.industry     = selectedIndustry.category_name;
                candidateProfessional.industryRole = jobSeeker.industryRole;
                candidateProfessional.skills       = jobSeeker.skills;
                candidateProfessional.areaId       = Convert.ToInt32(jobSeeker.Area);
                db.CandidateProfessional.Add(candidateProfessional);

                //commit changes to database
                db.SaveChanges();

                //store user name and role in session cookies and redirect to recruiter index page
                Session["UserName"] = jobSeeker.username;
                Session["UserRole"] = "jobseeker";
                return(RedirectToAction("Index", "JobSeeker", new { area = "JobSeeker" }));
            }

            ViewBag.Question = new SelectList(db.Questions, "quesId", "ques");
            ViewBag.industry = new SelectList(db.Categories, "category_id", "category_name");
            return(View());
        }
        public ActionResult EditProfile(int candidateId)
        {
            CandidateBasic candidate = db.CandidateBasic.Single(c => c.candidateId == candidateId);

            return(View(candidate));
        }
Beispiel #7
0
        public ActionResult CandidateDetails(int id)
        {
            CandidateBasic candidate = db.CandidateBasic.Single(c => c.candidateId == id);

            return(View(candidate));
        }