public JsonResult SaveCandidate(Guid userId)
        {
            var accID          = int.Parse(User.Identity.Name);
            var acc            = new AccountDao().FindAccountById(accID);
            var employee       = new EmployeeDao().FindById(acc.UserId);
            var enterpriseId   = employee.EnterpriseID;
            var savedCandidate = new SavedCandidate();
            //   Guid enterpriseId = new Guid("4c0bba20-27f2-4838-8cb9-ce3a80ce7784");
            DateTime date = DateTime.Today;

            savedCandidate.UserID       = userId;
            savedCandidate.EnterpriseID = enterpriseId;
            savedCandidate.CreateDate   = date.ToString("dd/MM/yyyy");
            var checkInsertCandidate = new SavedCandidateDao().InsertCandidate(savedCandidate);

            if (checkInsertCandidate == false)
            {
                return(Json(new
                {
                    status = false
                }));
            }
            return(Json(new
            {
                status = true
            }));
        }
        public JsonResult SaveCandidate(Guid userId)
        {
            /*  var accID = int.Parse(User.Identity.Name);
            *   var acc = new AccountDao().FindAccountById(accID);
            *   var employee = new EmployeeDao().FindById(acc.UserId);
            *   var enterpriseId = employee.EnterpriseID;   */

            var enterpriseId = new Guid("ed4a47ea-f261-491e-aff4-6e29d36ece42");

            var      savedCandidate = new SavedCandidate();
            DateTime date           = DateTime.Today;

            savedCandidate.UserID       = userId;
            savedCandidate.EnterpriseID = enterpriseId;
            savedCandidate.CreateDate   = date.ToString("dd/MM/yyyy");
            var checkInsertCandidate = new SavedCandidateDao().InsertCandidate(savedCandidate);

            if (checkInsertCandidate == false)
            {
                return(Json(new
                {
                    status = false
                }));
            }
            return(Json(new
            {
                status = true
            }));
        }
 public bool InsertCandidate(SavedCandidate savedCandidate)
 {
     try
     {
         db.SavedCandidates.Add(savedCandidate);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public bool DeleteCandidate(SavedCandidate savedCandidate)
 {
     try
     {
         db.SavedCandidates.Attach(savedCandidate);
         db.SavedCandidates.Remove(savedCandidate);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        //set process for saved candidate
        public JsonResult SetProcess(int?Id_SavedCandidate, string Process)
        {
            SavedCandidate savedCandidate = db.SavedCandidates.Find(Id_SavedCandidate);
            bool           result         = false;

            if (savedCandidate != null)
            {
                savedCandidate.Process = Process;
                db.SaveChanges();
                result = true;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        //delete  saved candidate
        public JsonResult DeleteSavedCandidate(int?Id_SavedCandidate)
        {
            SavedCandidate savedCandidate = db.SavedCandidates.Find(Id_SavedCandidate);

            bool result = false;

            if (savedCandidate != null)
            {
                db.SavedCandidates.Remove(savedCandidate);
                db.SaveChanges();
                result = true;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        //mark a candidate = saved
        public JsonResult SaveProfile(int?Id_candidate)
        {
            bool result = false;

            if (Id_candidate != null)
            {
                ModelState.Clear();
                NoBordersDB db = new NoBordersDB();


                var candidate = db.CandidateProfiles.Single(cand => cand.Id_candidate == Id_candidate);

                //get the list of all the experiences for the logged in user
                candidate.CandidateExperience = db.CandidateExperiences.Where(x => x.Id_candidate == Id_candidate).ToList();
                //get the list of all the studies for the logged user
                candidate.CandidateStudies = db.CandidateStudies.Where(x => x.id_candidate == Id_candidate).ToList();
                //get the list of all the technologies for the logged user
                candidate.CandidateTechnologies = db.CandidateTechnologies.Where(x => x.id_candidate == Id_candidate).ToList();
                //get the list of all the languages for the logged user
                candidate.CandidateLanguages = db.CandidateLanguages.Where(x => x.id_candidate == Id_candidate).ToList();

                SavedCandidate savedCandidate = new SavedCandidate();

                //retrieve the email of the logged in recruiter
                string recruiterEmail = (string)Session["recruiter_email"];
                var    checkemail     = db.SavedCandidates.FirstOrDefault(x => x.Email == candidate.Email && x.Recruiter_email == recruiterEmail);

                //check if the candidate is allready saved
                if (checkemail == null)
                {
                    savedCandidate.Email           = candidate.Email;
                    savedCandidate.First_name      = candidate.First_name;
                    savedCandidate.Last_name       = candidate.Last_name;
                    savedCandidate.Country_to_work = candidate.Country_To_Work;
                    savedCandidate.Status          = candidate.Interest;
                    savedCandidate.Recruiter_email = Session["recruiter_email"].ToString();

                    savedCandidate.Process = "";

                    List <CandidateTechnologies> skills = candidate.CandidateTechnologies.Where(x => x.tech_level == "Senior    ").ToList();
                    if (skills.Count == 0)
                    {
                        skills = candidate.CandidateTechnologies.Where(x => x.tech_level == "Middle    ").ToList();

                        if (skills.Count == 0)
                        {
                            skills = candidate.CandidateTechnologies.Where(x => x.tech_level == "Junior    ").ToList();
                            if (skills.Count == 0)
                            {
                                savedCandidate.Skill      = "N/A";
                                savedCandidate.Experience = "N/A";
                            }
                            else
                            {
                                savedCandidate.Skill      = skills[0].tech_name;
                                savedCandidate.Experience = skills[0].tech_level;
                            }
                        }
                        else
                        {
                            savedCandidate.Skill      = skills[0].tech_name;
                            savedCandidate.Experience = skills[0].tech_level;
                        }
                    }
                    else
                    {
                        savedCandidate.Skill      = skills[0].tech_name;
                        savedCandidate.Experience = skills[0].tech_level;
                    }


                    db.SavedCandidates.Add(savedCandidate);
                    db.SaveChanges();
                    result = true;
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }