public List <candidatepostion> getuserisactive(string Loginname)
        {
            List <candidatepostion> candiposi = new List <candidatepostion>();

            using (RecrutmentsysEntities db = new RecrutmentsysEntities())
            {
                var id   = db.COMPANY_HR_REGISTER.Where(o => o.HrEmail == Loginname);
                int hrid = id.FirstOrDefault().HrId;
                candidatepostion can;
                var users = db.CANDIDATE_POSITION.ToList();
                foreach (CANDIDATE_POSITION u in db.CANDIDATE_POSITION.Where(o => o.HrId == hrid))
                {
                    can                    = new candidatepostion();
                    can.canid              = u.CandidateId;
                    can.candidatecode      = u.CandidateCode;
                    can.departmentcode     = u.DepartmentCode;
                    can.Departmentname     = u.DepartmentName;
                    can.email              = u.CandidateEmail;
                    can.candi_yer_of_exper = Convert.ToInt32(u.Candidate_Yof_exp);
                    can.Isactive           = Convert.ToBoolean(u.ISActive);
                    candiposi.Add(can);
                }
            }
            return(candiposi);
        }
 public void approvalisactiveuser(candidatepostion can)
 {
     using (RecrutmentsysEntities db = new RecrutmentsysEntities())
     {
         CANDIDATE_POSITION cp = db.CANDIDATE_POSITION.Find(can.canid);
         cp.ISActive = can.Isactive;
         db.SaveChanges();
     }
 }
 public void addcandidateposition(candidatepostion CP, string code)
 {
     using (RecrutmentsysEntities db = new RecrutmentsysEntities())
     {
         COMPANY_JOB_OPENING data = db.COMPANY_JOB_OPENING.Where(o => o.DepartmentCode == code).FirstOrDefault();
         if (data != null)
         {
             CANDIDATE_POSITION CANP = new CANDIDATE_POSITION();
             CANP.CompanyId         = data.CompanyId;
             CANP.DepartmentCode    = data.DepartmentCode;
             CANP.DepartmentName    = data.DepartmentName;
             CANP.HrId              = data.HrId;
             CANP.CandidateEmail    = CP.email;
             CANP.Candidate_Yof_exp = CP.year_of_experience;
             CANP.ISActive          = false;
             db.CANDIDATE_POSITION.Add(CANP);
             db.SaveChanges();
         }
     }
 }
        public ActionResult addcandidate(candidatepostion cp)
        {
            candidate();
            candidatepostion obj = new candidatepostion();

            obj.Deptcode = ViewBag.obj1;
            if (ModelState.IsValid)
            {
                if (cp.departmentcode == "Select")
                {
                    ViewBag.foo = "you have not select please selct";
                    return(View(obj));
                }
                else
                {
                    UserManager UM = new UserManager();
                    if (!UM.IspostionEmailExits(cp.email))
                    {
                        //ViewBag.foo = cp.departmentcode;
                        UM.addcandidateposition(cp, cp.departmentcode);
                        ModelState.Clear();
                        candidate();
                        obj.Deptcode    = ViewBag.obj1;
                        TempData["msg"] = "Insert save successfully";
                    }
                    else
                    {
                        ModelState.AddModelError("", "Email Is Already in use");
                    }
                }
            }
            if (cp.departmentcode == "Select")
            {
                ViewBag.foo = "please select first?";
                return(View(obj));
            }

            return(View(obj));
        }
        public ActionResult addcandidate()
        {
            string loginname = HttpContext.User.Identity.Name;

            RecrutmentsysEntities db = new RecrutmentsysEntities();

            var id   = db.COMPANY_HR_REGISTER.Where(o => o.HrEmail == loginname);
            int hrid = id.FirstOrDefault().HrId;
            List <COMPANY_JOB_OPENING> objdeptcode = (from data in db.COMPANY_JOB_OPENING
                                                      where data.HrId == hrid && data.Approval == true
                                                      select data).ToList();
            COMPANY_JOB_OPENING cjo = new COMPANY_JOB_OPENING();

            cjo.DepartmentCode = "Select";
            objdeptcode.Insert(0, cjo);
            SelectList       objdpt = new SelectList(objdeptcode, "DepartmentCode", "DepartmentCode", 0);
            candidatepostion obj    = new candidatepostion();

            obj.Deptcode = objdpt;

            return(View(obj));
        }