Exemple #1
0
        public List <AppliedJob> GetAppliedCandidatesDetails(int id)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select * from Gender inner join JobSeekersInfo on Gender.ID = JobSeekersInfo.GenderID inner join AppliedJobInfo on JobSeekersInfo.SeekerID = AppliedJobInfo.SeekerID and AppliedJobInfo.AppliedJobID = " + id;

            connection.Open();

            SqlCommand    command = new SqlCommand(query, connection);
            SqlDataReader reader  = command.ExecuteReader();

            List <AppliedJob> appliedCandidateslist = new List <AppliedJob>();

            while (reader.Read())
            {
                int      appliedJobID  = Convert.ToInt32(reader["AppliedJobID"]);
                int      seekerID      = Convert.ToInt32(reader["SeekerID"]);
                string   seekerName    = reader["Name"].ToString();
                string   seekerEmail   = reader["Email"].ToString();
                string   seekerAddress = reader["Address"].ToString();
                string   gender        = reader["Type"].ToString();
                string   coverLetter   = reader["CoverLetter"].ToString();
                DateTime appliedTime   = Convert.ToDateTime(reader["AppliedTime"]);


                AppliedJob appliedJob = new AppliedJob(appliedJobID, seekerID, seekerName, seekerEmail, seekerAddress, gender, coverLetter, appliedTime);

                appliedCandidateslist.Add(appliedJob);
            }
            return(appliedCandidateslist);
        }
        public ActionResult Details(int Id)
        {
            AppliedJob info = new AppliedJob();

            info = repository.AppliedJobs.Where(r => r.Id == Id).FirstOrDefault();
            return(PartialView("ApplicantDetails", info));
        }
        public ActionResult AppliedJobs(int jobId, string status)
        {
            AppliedJob aJob = repository.AppliedJobs.FirstOrDefault(j => j.Id == jobId);

            repository.UpdateAppliedStatus(aJob, status);
            return(View(repository.AppliedJobs));
        }
Exemple #4
0
        public bool IsAlreadyApplied(AppliedJob appliedJob, int jobID, int seekerID)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "Select * from AppliedJobInfo where SeekerID =(@seekerID) and JobID = (@jobID)";

            connection.Open();

            SqlCommand command = new SqlCommand(query, connection);

            command.Parameters.Add("seekerID", SqlDbType.Int);
            command.Parameters["seekerID"].Value = seekerID;

            command.Parameters.Add("jobID", SqlDbType.Int);
            command.Parameters["jobID"].Value = jobID;

            command.CommandText = query;
            command.Connection  = connection;

            SqlDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        public ActionResult JobApplication(JobApplicationViewModel jobApplication)
        {
            if (ModelState.IsValid)
            {
                var jobId          = jobApplication.Job.JobId;
                var jobSeekerId    = jobApplication.JobSeekerId;
                var expectedsalary = jobApplication.ExpectedSalary;
                var appliedJob     = new AppliedJob()
                {
                    JobId             = jobId,
                    JobSeekerId       = jobSeekerId,
                    ExpectedSalary    = expectedsalary,
                    DateOfApplication = DateTime.Now
                };
                var isApplicationSuccessful = Repository.ApplyForJob(appliedJob);

                if (!isApplicationSuccessful)
                {
                    Session.Add("message", "Your application for the job could not be completed!");

                    return(RedirectToAction("JobApplication", "JobSeeker", new { @id = jobId }));
                }

                Session.Add("message", "Your have successfully applied for the following post:");

                return(RedirectToAction("ConfirmJobApplication", "JobSeeker", new { @id = jobId }));
            }

            return(View(jobApplication));
        }
        public JsonResult GetMatchingDetail2(string applicantID1, string applicantID2, int jobID)
        {
            if (!String.IsNullOrEmpty(applicantID1) &&
                !String.IsNullOrEmpty(applicantID2))
            {
                AppliedJob appliedJob1 = applicantUnitOfWork.AppliedJobRepository.Get(s => s.JobSeekerID == applicantID1 && s.JobID == jobID).FirstOrDefault();
                AppliedJob appliedJob2 = applicantUnitOfWork.AppliedJobRepository.Get(s => s.JobSeekerID == applicantID2 && s.JobID == jobID).FirstOrDefault();

                if (appliedJob1 != null && appliedJob2 != null)
                {
                    int profileID1 = appliedJob1.ProfileID;
                    int profileID2 = appliedJob2.ProfileID;

                    var sosanhItemList1 = applicantUnitOfWork.GetMatchingDetail(profileID1, jobID);
                    var sosanhItemList2 = applicantUnitOfWork.GetMatchingDetail(profileID2, jobID);

                    Jobseeker applicant1 = applicantUnitOfWork.JobseekerRepository.GetByID(applicantID1);
                    Jobseeker applicant2 = applicantUnitOfWork.JobseekerRepository.GetByID(applicantID2);

                    return(Json(new { profile1 = sosanhItemList1, profile2 = sosanhItemList2, applicantname1 = applicant1.FullName, applicantname2 = applicant2.FullName }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(this.Json(string.Empty));
                }
            }
            else
            {
                return(this.Json(string.Empty));
            }
        }
Exemple #7
0
        public int InsertJobApplication(AppliedJob appliedJob, int jobID, int seekerID)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "INSERT INTO AppliedJobInfo (SeekerID, JobID, CoverLetter, AppliedTime) VALUES (@seekerID, @jobID, @coverLetter, @appliedTime)";

            connection.Open();
            SqlCommand command = new SqlCommand(query, connection);

            command.Parameters.Clear();

            command.Parameters.Add("SeekerID", SqlDbType.Int);
            command.Parameters["SeekerID"].Value = seekerID;

            command.Parameters.Add("JobID", SqlDbType.Int);
            command.Parameters["JobID"].Value = jobID;

            command.Parameters.Add("coverLetter", SqlDbType.VarChar);
            command.Parameters["coverLetter"].Value = appliedJob.CoverLetter;

            command.Parameters.Add("appliedTime", SqlDbType.DateTime);
            command.Parameters["appliedTime"].Value = DateTime.Today;

            command.CommandText = query;
            command.Connection  = connection;

            int rowAffected = command.ExecuteNonQuery();

            return(rowAffected);
        }
        public bool ApplyJob(int jobID, int profileID, string userID)
        {
            Job job = this.JobRepository.GetByID(jobID);
            Profile profile = this.ProfileRepository.GetByID(profileID);
            Jobseeker jobseeker = this.JobseekerRepository.GetByID(userID);

            if (job != null && profile != null && jobseeker != null)
            {
                AppliedJob appliedJob = this.AppliedJobRepository.Get(s => s.JobID == jobID && s.JobSeekerID == userID).FirstOrDefault();
                if (appliedJob != null)
                {
                    if (appliedJob.IsDeleted == true)
                    {
                        appliedJob.ProfileID = profileID;
                        appliedJob.ApplyDate = DateTime.Now;
                        appliedJob.MatchingPercent = this.Matching(profileID, jobID);
                        appliedJob.Status = 0;
                        appliedJob.AcceptDate = null;
                        appliedJob.IsDeleted = false;
                        this.AppliedJobRepository.Update(appliedJob);
                        this.Save();

                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    AppliedJob newAppliedJob = new AppliedJob();
                    newAppliedJob.JobID = jobID;
                    newAppliedJob.ProfileID = profileID;
                    newAppliedJob.JobSeekerID = userID;
                    newAppliedJob.ApplyDate = DateTime.Now;
                    newAppliedJob.MatchingPercent = this.Matching(profileID, jobID);
                    newAppliedJob.Status = 0;
                    newAppliedJob.AcceptDate = null;
                    newAppliedJob.IsDeleted = false;

                    this.AppliedJobRepository.Insert(newAppliedJob);
                    this.Save();

                    return true;
                }
            }

            return false;
        }
        public bool ApplyJob(int jobID, int profileID, string userID)
        {
            Job       job       = this.JobRepository.GetByID(jobID);
            Profile   profile   = this.ProfileRepository.GetByID(profileID);
            Jobseeker jobseeker = this.JobseekerRepository.GetByID(userID);

            if (job != null && profile != null && jobseeker != null)
            {
                AppliedJob appliedJob = this.AppliedJobRepository.Get(s => s.JobID == jobID && s.JobSeekerID == userID).FirstOrDefault();
                if (appliedJob != null)
                {
                    if (appliedJob.IsDeleted == true)
                    {
                        appliedJob.ProfileID       = profileID;
                        appliedJob.ApplyDate       = DateTime.Now;
                        appliedJob.MatchingPercent = this.Matching(profileID, jobID);
                        appliedJob.Status          = 0;
                        appliedJob.AcceptDate      = null;
                        appliedJob.IsDeleted       = false;
                        this.AppliedJobRepository.Update(appliedJob);
                        this.Save();

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    AppliedJob newAppliedJob = new AppliedJob();
                    newAppliedJob.JobID           = jobID;
                    newAppliedJob.ProfileID       = profileID;
                    newAppliedJob.JobSeekerID     = userID;
                    newAppliedJob.ApplyDate       = DateTime.Now;
                    newAppliedJob.MatchingPercent = this.Matching(profileID, jobID);
                    newAppliedJob.Status          = 0;
                    newAppliedJob.AcceptDate      = null;
                    newAppliedJob.IsDeleted       = false;

                    this.AppliedJobRepository.Insert(newAppliedJob);
                    this.Save();

                    return(true);
                }
            }

            return(false);
        }
 //Reject applicant
 public bool RejectApplicant(string id, int jobID)
 {
     try
     {
         AppliedJob appliedJob = this.AppliedJobRepository.Get(applicant => applicant.JobSeekerID == id && applicant.JobID == jobID).SingleOrDefault();
         appliedJob.Status = 2;
         this.AppliedJobRepository.Update(appliedJob);
         this.Save();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #11
0
        public bool ApplyForJob(AppliedJob appliedJob)
        {
            try
            {
                var applicant = GetJobSeekerById(appliedJob.JobSeekerId);

                GetJobById(appliedJob.JobId).Applicants.Add(applicant);
                Db.AppliedJobs.Add(appliedJob);

                Db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
      public async Task <IActionResult> Apply(JobPosting jobPosting)
      {
          if (ModelState.IsValid)
          {
              _context.Add(jobPosting);
              await _context.SaveChangesAsync();

              AppliedJob appliedJob = new AppliedJob();
              appliedJob.UserID       = User.Identity.Name;
              appliedJob.JobPostingID = jobPosting.JobPostingID;
              _context.Add(appliedJob);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          ViewData["UserID"] = new SelectList(_context.Employers, "UserID", "Company", jobPosting.UserID);
          return(View(jobPosting));
      }
        public int DeleteAppliedRequest(int jobId, string jobseekerId)
        {
            var listBeforeDelete = (from a in this.AppliedJobRepository.Get()
                                    where a.JobID == jobId && a.JobSeekerID == jobseekerId && a.IsDeleted == true
                                    select a).ToArray();


            AppliedJob appliedJob = AppliedJobRepository.Get(filter: m => m.JobID == jobId && m.JobSeekerID == jobseekerId).FirstOrDefault();

            appliedJob.IsDeleted = true;
            AppliedJobRepository.Update(appliedJob);
            Save();

            var list = (from a in this.AppliedJobRepository.Get()
                        where a.JobID == jobId && a.JobSeekerID == jobseekerId
                        select a).ToArray();

            return(listBeforeDelete.Length - list.Length);
        }
Exemple #14
0
        public ActionResult ApplyJob(AppliedJob appliedJob, int id)
        {
            var session = Session["user"] as Seeker;

            if (session == null)
            {
                return(RedirectToAction("LoginAccount", "Login"));
            }
            int seekerID = session.SeekerID;

            List <JobInfo> jobInfoList = jobManager.GetDetailJobInfo(id);

            ViewBag.jobInfo = jobInfoList;

            string message = jobManager.InsertJobApplication(appliedJob, id, seekerID);

            ViewBag.message = message;
            return(View());
        }
Exemple #15
0
        public List <AppliedJob> GetUserAppliedJobDetails(int seekerId)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select * from JobSeekersInfo inner join AppliedJobInfo  on JobSeekersInfo.SeekerID = AppliedJobInfo.SeekerID inner join JobInfo on JobInfo.JobID = AppliedJobInfo.JobID inner join EmployersInfo on EmployersInfo.EmployerID = JobInfo.EmployerID and JobSeekersInfo.SeekerID = " + seekerId;

            connection.Open();

            SqlCommand    command = new SqlCommand(query, connection);
            SqlDataReader reader  = command.ExecuteReader();

            List <AppliedJob> appliedJobslist = new List <AppliedJob>();

            while (reader.Read())
            {
                int      appliedJobID            = Convert.ToInt32(reader["AppliedJobID"]);
                int      jobID                   = Convert.ToInt32(reader["JobID"]);
                string   seekerName              = reader["Name"].ToString();
                string   seekerEmail             = reader["Email"].ToString();
                string   coverLetter             = reader["CoverLetter"].ToString();
                DateTime appliedTime             = Convert.ToDateTime(reader["AppliedTime"]);
                string   jobTitle                = reader["JobTitle"].ToString();
                string   jobDescription          = reader["JobDescription"].ToString();
                string   jobNature               = reader["JobNature"].ToString();
                string   educationalRequirements = reader["EducationalRequirements"].ToString();
                string   experienceRequirements  = reader["ExperienceRequirements"].ToString();
                string   additionalRequirements  = reader["AdditionalRequirements"].ToString();
                int      noOfVacancies           = Convert.ToInt32(reader["NoOfVacancies"]);
                string   salaryRange             = reader["SalaryRange"].ToString();
                string   otherBenefit            = reader["OtherBenefit"].ToString();
                DateTime applicationDeadline     = Convert.ToDateTime(reader["ApplicationDeadline"]);
                DateTime publishTime             = Convert.ToDateTime(reader["PublishTime"]);
                string   companyName             = reader["CompanyName"].ToString();
                string   companyEmail            = reader["ContactPersonEmail"].ToString();


                AppliedJob appliedJob = new AppliedJob(appliedJobID, jobID, seekerName, seekerEmail, coverLetter, appliedTime, jobTitle, jobDescription, jobNature, educationalRequirements, experienceRequirements, additionalRequirements, noOfVacancies, salaryRange, otherBenefit, applicationDeadline, publishTime, companyName, companyEmail);

                appliedJobslist.Add(appliedJob);
            }
            return(appliedJobslist);
        }
        public string InsertJobApplication(AppliedJob appliedJob, int jobID, int seekerID)
        {
            string message = "Applied Failed";

            bool isAlreadyApplied = jobGetway.IsAlreadyApplied(appliedJob, jobID, seekerID);

            if (isAlreadyApplied)
            {
                message = "You already applied for this job";
                return(message);
            }
            else
            {
                int isInserted = jobGetway.InsertJobApplication(appliedJob, jobID, seekerID);
                if (isInserted > 0)
                {
                    message = "Applied Successfully";
                }
                return(message);
            }
        }
        public JsonResult GetMatchingDetail(string applicantID, int jobID)
        {
            if (!String.IsNullOrEmpty(applicantID))
            {
                AppliedJob appliedJob = applicantUnitOfWork.AppliedJobRepository.Get(s => s.JobSeekerID == applicantID && s.JobID == jobID).FirstOrDefault();

                if (appliedJob != null)
                {
                    int profileID = appliedJob.ProfileID;

                    var sosanhItemList = applicantUnitOfWork.GetMatchingDetail(profileID, jobID);

                    return(Json(sosanhItemList, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(this.Json(string.Empty));
                }
            }
            else
            {
                return(this.Json(string.Empty));
            }
        }