public int AddAppliedJob(JobApplied objJob) { try { var JobDetails = _unitOfWork.Repository<Vacancy>().GetAll().Where(c => c.JobID == objJob.JobID).FirstOrDefault(); objJob.City = JobDetails.City; objJob.State = JobDetails.State; objJob.Country = JobDetails.Country; objJob.AppliedDate = DateTime.Now; objJob.CompanyName = JobDetails.CompanyName; objJob.JobPosition = JobDetails.JobPosition; objJob.LastDate = JobDetails.LastDate; objJob.Skill =Convert.ToInt32(JobDetails.Skill); objJob.JobStatus = "Applied"; _unitOfWork.Repository<JobApplied>().Insert(objJob); _unitOfWork.Save(); return 1; #region Using //using (JobASPContext context=new JobASPContext()) //{ // var JobDetails = context.Vacancies.Where(c => c.JobID == objJob.JobID).FirstOrDefault(); // objJob.City = JobDetails.City; // objJob.State = JobDetails.State; // objJob.AppliedDate = DateTime.Now; // objJob.CompanyName = JobDetails.Company; // objJob.JobPosition = JobDetails.JobPosition; // objJob.LastDate = JobDetails.LastDate; // objJob.JobStatus = "Applied"; // context.JobApplies.Add(objJob); // context.SaveChanges(); // return 1; //} #endregion } catch (Exception) { return 0; } }
//protected void gvFindJobs_PageIndexChanging(object sender, GridViewPageEventArgs e) //{ // //gvFindJobs.PageIndex = e.NewPageIndex; // //SearchDetails objSearch = new SearchDetails(); // //objSearch.Skill = ddlSkillSet.SelectedItem.Text; // //objSearch.Country = ddlCountry.SelectedItem.Text; // //objSearch.State = ddlState.SelectedItem.Text; // //objSearch.City = ddlCity.SelectedItem.Text; // //gvFindJobs.DataSource = new AddJobBO().ListVacancy(objSearch); // //gvFindJobs.DataBind(); //} protected void gvJobApply_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "ApplyJob") { if (Session["Valid"] != null) { JobApplied objApplied = new JobApplied(); objApplied.AppliedDate = DateTime.Now; int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvJobApply.Rows[index]; objApplied.JobID = Convert.ToInt32(row.Cells[0].Text); objApplied.SeekerID = Convert.ToInt32(Session["ID"].ToString()); int i = new JobAppliedBO().AddAppliedJob(objApplied); if (i == 1) { bind(); } else { } } else { Response.Redirect("Login.aspx"); } } } catch (Exception) { ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertDanger", "funcAlertWrong();", true); } }
protected void gvJobApply_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "ApplyJob") { JobApplied objApplied = new JobApplied(); objApplied.AppliedDate = DateTime.Now; int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvJobApply.Rows[index]; objApplied.JobID = Convert.ToInt32(row.Cells[0].Text); objApplied.SeekerID = Convert.ToInt32(Session["ID"].ToString()); int i = new JobAppliedBO().AddAppliedJob(objApplied); if (i == 1) { lblProSeeker.Text = "Job applied Successfully"; bind(); } else { lblProSeeker.Text = "you have already applied this job"; } } } catch (Exception) { lblProSeeker.Text = "Something Went Wrong"; } }
protected void btngvApply_Click(object sender, EventArgs e) { int res = 0; foreach (GridViewRow row in gvJobApply.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkRow = (row.Cells[0].FindControl("chkgvjobApply") as CheckBox); if (chkRow.Checked) { JobApplied objApplied = new JobApplied(); objApplied.AppliedDate = DateTime.Now; objApplied.JobID = Convert.ToInt32(row.Cells[1].Text); objApplied.SeekerID = Convert.ToInt32(Session["ID"].ToString()); int i = new JobAppliedBO().AddAppliedJob(objApplied); if (i == 1) { res++; } } } } if (res > 0) { if (res > 1) { lblProSeeker.Text = "Job applied Successfully"; } else { if (res > 2) { lblProSeeker.Text = "Job's applied Successfully"; } } } bind(); AppliedBind(); }