protected void Page_Load(object sender, EventArgs e) { string Jobid = Request.QueryString["id"]; string Empid = Request.QueryString["empId"]; int JobidParsed = int.Parse(Jobid); int EmpidParsed = int.Parse(Empid); Job GotJobDetails = new Job(); BLL.BLLRecruiterWebsiteManager GettingJobDetailsMethod = new BLLRecruiterWebsiteManager(); GotJobDetails = GettingJobDetailsMethod.GetJobDetails(JobidParsed, EmpidParsed); lblGetJobTitle.Text = GotJobDetails.Title.ToString(); lblGetCompany.Text = GotJobDetails.Company.ToString(); lblGetLocation.Text = GotJobDetails.Location.ToString(); lblGetDescription.Text = GotJobDetails.Description.ToString(); lblGetJobType.Text = GotJobDetails.Type.ToString(); lblGetSalary.Text = GotJobDetails.Salary.ToString(); lblGetDataCreated.Text = GotJobDetails.DateCreated.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string JobType = Request.QueryString["Type"]; string Location = Request.QueryString["loc"]; lblJobCategory.Text = JobType.ToString(); lblLocationSearch.Text = Location.ToString(); Job SearchJobRequest = new Job(); List<Job> JobList = new List<Job>(); BLLRecruiterWebsiteManager RequestJobSearch = new BLLRecruiterWebsiteManager(); JobList = RequestJobSearch.SearchJob(JobType, Location); // List<Job> EditJobList = new List<Job>(); GridView1.DataSource = from t in JobList orderby t.DateCreated ascending select new { t.JobID, t.EmpID, t.Category, t.Title, t.Company, t.Location, t.Description, t.Type, t.Terms, t.Salary, t.DateCreated }; // GridView1.DataBound(); GridView1.DataBind(); }
// method for entering job into database public bool InsertJob(Job job) { bool result = false; try { DALRecruiterWebsiteManager DALMngr = new DALRecruiterWebsiteManager(); result = DALMngr.InsertJobDetails(job); } catch (Exception ex) { throw; } return result; }
// Get job details for apply job page. public Job GetJobDetails(int Jobid, int Empid) { DALRecruiterWebsiteManager RequestingJobDetails = new DALRecruiterWebsiteManager(); Job GotJobDetails = new Job(); GotJobDetails = RequestingJobDetails.GetJobDetails(Jobid, Empid); return GotJobDetails; }
public void CreateJob() { string jobCategory; string company; string title; string location; string description; string requirements ; string type; string terms; decimal salary; string link = string.Empty; jobCategory = drplstCreateJobCategory.SelectedItem.ToString(); company = txtCompany.Text; title = txtCreateJobTitle.Text; location = drplstCreateJobLocation.SelectedItem.ToString(); description = txtCreateJobDescription.Text; requirements = txtCreateJobRequirements.Text; type = drplstCreateJobType.SelectedItem.ToString(); terms = drplstCreateJobTerms.SelectedItem.ToString(); bool isValid = decimal.TryParse(txtCreateJobSalary.Text, out salary); if (!IsValid) { txtCreateJobSalary.Text = "Invalid entry"; } if(isValid) { Job job = new Job(jobCategory, company, title, location, description, requirements, type, terms, salary, link); job.EmpID = (int)Session["EmployerID"]; // job.Link = string.Format(("~/Job.aspx?id={0}&empId={1}"), job.JobID.ToString(), job.EmpID.ToString()); job.DateCreated = DateTime.Now; try { BLLRecruiterWebsiteManager BLLMngr = new BLLRecruiterWebsiteManager(); job.Link = string.Format(("~/Job.aspx?id={0}&empId={1}"), job.JobID.ToString(), job.EmpID.ToString()); bool result = BLLMngr.InsertJob(job); if (result == true) { job.Link = string.Format(("~/Job.aspx?id={0}&empId={1}"), job.JobID.ToString(), job.EmpID.ToString()); //NEW CODE I'VE ENTERED FOR EMAILER List<WatchedJob> watchJobList = BLLMngr.GetListOfWatchedJobsFromDAL(); List<Jobseeker> jobseekerList = BLLMngr.ListOfJobseekers(); Jobseeker getJobsseeker = null; foreach (WatchedJob wj in watchJobList) { foreach (Jobseeker j in jobseekerList) { if (j.JobseekerID == wj.JobseekerID) { getJobsseeker = j; } } if (jobCategory == "Finance") { if (wj.Finance == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Computing") { if (wj.Computing == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Retail") { if (wj.Retail == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); ; } } else if (jobCategory == "Sales") { if (wj.Sales == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Engineering") { if (wj.Engineering == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Legal") { if (wj.Legal == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Tourism") { if (wj.Tourism == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Publishing") { if (wj.Publishing == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Telecoms") { if (wj.Telecoms == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } else if (jobCategory == "Manufacturing") { if (wj.Manufacturing == true) { SendNotificationOfNewJobMail(getJobsseeker.JobseekerEmail, getJobsseeker.JobseekerUsername, jobCategory, title, description); } } } /* Computing Retail Sales Engineering Legal Tourism Publishing Telecoms Manufacturing * */ //END OF NEW CODE DataRow row = dt.NewRow(); /* dt.Columns.Add("jobID"); dt.Columns.Add("empID"); * */ row["jobID"] = job.JobID; job.Link = string.Format(("~/JobApply.aspx?id={0}&empId={1}"), job.JobID.ToString(), job.EmpID.ToString()); row["empID"] = job.EmpID; row["jobCategory"] = job.Category; row["company"] = job.Company; row["title"] = job.Title; row["location"] = job.Location; row["description"] = job.Description; row["requirements"] = job.Requirements; row["terms"] = job.Terms; row["salary"] = job.Salary; row["link"] = job.Link; row["dateCreated"] = job.DateCreated; dt.Rows.Add(row); ds.AcceptChanges(); ds.WriteXml(Server.MapPath("~/XML/Jobs.xml")); Response.Redirect("~/JobSearch.aspx?Type=" + job.Category.ToString() + "&loc=" + job.Location.ToString() + ""); } } catch (Exception ex) { throw; } } /* Validations validate = new Validations(); string isValid = validate.ValidateXMLUsingXSD(); if(isValid == string.Empty) { }*/ }
// Gets all the current live jobs for Employer profile. public List<Job>GetJobListForEmployerProfile(int EmployerID) { List<Job> JobsList = new List<Job>(); try { using (SqlConnection Cxn = new SqlConnection(CxnString)) { using (SqlCommand Cmd = new SqlCommand("spGetJobListEmployerProfile",Cxn)) { Cmd.CommandType = CommandType.StoredProcedure; SqlParameter EmpIdParam = new SqlParameter("@EmpId", SqlDbType.Int); EmpIdParam.Value = EmployerID; Cmd.Parameters.Add(EmpIdParam); Cxn.Open(); dr = Cmd.ExecuteReader(); while (dr.Read()) { Job JobObject = new Job(); int JobID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobID))); int EmpID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetEmpID))); string Category = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetCategory)).ToString()); string Company = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_Company)).ToString()); string Title = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTitle)).ToString()); string Location = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetLocation)).ToString()); string JobDesc = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobDesc)).ToString()); string Requirements = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetRequirements)).ToString()); string JobType = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobType)).ToString()); string Terms = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTerms)).ToString()); decimal Salary = Convert.ToDecimal(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetSalary))); DateTime Date = Convert.ToDateTime(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetDateCreated))); JobObject.JobID = JobID; JobObject.EmpID = EmpID; JobObject.Category = Category; JobObject.Company = Company; JobObject.Title = Title; JobObject.Location = Location; JobObject.Description = JobDesc; JobObject.Requirements = Requirements; JobObject.Type = JobType; JobObject.Terms = Terms; JobObject.Salary = Salary; JobObject.DateCreated = Date; JobsList.Add(JobObject); } } } } catch (SqlException ex) { throw; } return JobsList; }
// gets jobs details for people applying for a role. public Job GetJobDetails(int Jobid, int Empid) { Job GetJobDetail = new Job(); try { using (SqlConnection Cxn = new SqlConnection(CxnString)) { using (SqlCommand Cmd = new SqlCommand("GetJobDetails",Cxn)) { Cmd.CommandType = CommandType.StoredProcedure; SqlParameter JobidParam = new SqlParameter("@Jobid", SqlDbType.Int); SqlParameter EmpidParam = new SqlParameter("@Empid", SqlDbType.Int); JobidParam.Value = Jobid; EmpidParam.Value = Empid; Cmd.Parameters.Add(JobidParam); Cmd.Parameters.Add(EmpidParam); Cxn.Open(); dr = Cmd.ExecuteReader(); while (dr.Read()) { int JobID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobID))); int EmpID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetEmpID))); string Category = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetCategory)).ToString()); string Company = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_Company)).ToString()); string Title = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTitle)).ToString()); string Location = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetLocation)).ToString()); string JobDesc = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobDesc)).ToString()); string Requirements = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetRequirements)).ToString()); string JobType = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobType)).ToString()); string Terms = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTerms)).ToString()); DateTime Date = Convert.ToDateTime(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetDateCreated))); decimal Salary = Convert.ToDecimal(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetSalary))); GetJobDetail.JobID = JobID; GetJobDetail.EmpID = EmpID; GetJobDetail.Category = Category; GetJobDetail.Company = Company; GetJobDetail.Title = Title; GetJobDetail.Location = Location; GetJobDetail.Description = JobDesc; GetJobDetail.Requirements = Requirements; GetJobDetail.Type = JobType; GetJobDetail.Terms = Terms; GetJobDetail.Salary = Salary; GetJobDetail.DateCreated = Date; } dr.Close(); Cxn.Close(); } } return GetJobDetail; } catch (SqlException ex) { throw; } }
// This controls the search option, takes two parameters. public List<Job> SearchJobsList(string JobType, string Location) { List<Job> JobList = new List<Job>(); try { using (SqlConnection Cxn = new SqlConnection(CxnString)) { using (SqlCommand Cmd = new SqlCommand("spSearchJob", Cxn)) { Cmd.CommandType = CommandType.StoredProcedure; SqlParameter JobTypeParam = new SqlParameter("@JobType", SqlDbType.NVarChar, 50); SqlParameter LocationParam = new SqlParameter("@Location", SqlDbType.NVarChar, 50); JobTypeParam.Value = JobType; LocationParam.Value = Location; Cmd.Parameters.Add(JobTypeParam); Cmd.Parameters.Add(LocationParam); // SqlDataReader testingSqlDataReader; Cxn.Open(); dr = Cmd.ExecuteReader(); while (dr.Read()) { Job SearchJob = new Job(); int JobID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobID))); int EmpID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetEmpID))); string Category = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetCategory)).ToString()); string Company = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_Company)).ToString()); string Title = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTitle)).ToString()); string Location1 = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetLocation)).ToString()); string JobDesc = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobDesc)).ToString()); string Requirements = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetRequirements)).ToString()); string JobType1 = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobType)).ToString()); string Terms = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTerms)).ToString()); decimal Salary = Convert.ToDecimal(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetSalary))); DateTime Date = Convert.ToDateTime(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetDateCreated))); SearchJob.JobID = JobID; SearchJob.EmpID = EmpID; SearchJob.Category = Category; SearchJob.Company = Company; SearchJob.Title = Title; SearchJob.Location = Location1; SearchJob.Description = JobDesc; SearchJob.Requirements = Requirements; SearchJob.Type = JobType1; SearchJob.Terms = Terms; SearchJob.Salary = Salary; SearchJob.DateCreated = Date; JobList.Add(SearchJob); } dr.Close(); Cxn.Close(); } } } catch (SqlException ex) { throw; } return JobList; }
// Get a list of all the jobs for the Admin section public List<Job> GetAllJobsForAdminSection() { List<Job> ListOfAllActiveJobs = new List<Job>(); try { using (SqlConnection Cxn = new SqlConnection(CxnString)) { using (SqlCommand Cmd = new SqlCommand("spGetAllJobsForAdmin", Cxn)) { Cxn.Open(); dr = Cmd.ExecuteReader(); while (dr.Read()) { Job JobAdminProfile = new Job(); int JobID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobID))); int EmpID = Convert.ToInt32(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetEmpID))); string Category = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetCategory)).ToString()); string Company = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_Company)).ToString()); string Title = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTitle)).ToString()); string Location1 = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetLocation)).ToString()); string JobDesc = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobDesc)).ToString()); string Requirements = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetRequirements)).ToString()); string JobType1 = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetJobType)).ToString()); string Terms = (dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetTerms)).ToString()); decimal Salary = Convert.ToDecimal(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetSalary))); DateTime Date = Convert.ToDateTime(dr.GetValue(Convert.ToInt32(Job_GetJobDetail.SP_GetDateCreated))); JobAdminProfile.JobID = JobID; JobAdminProfile.EmpID = EmpID; JobAdminProfile.Category = Category; JobAdminProfile.Company = Company; JobAdminProfile.Title = Title; JobAdminProfile.Location = Location1; JobAdminProfile.Description = JobDesc; JobAdminProfile.Requirements = Requirements; JobAdminProfile.Type = JobType1; JobAdminProfile.Terms = Terms; JobAdminProfile.Salary = Salary; JobAdminProfile.DateCreated = Date; ListOfAllActiveJobs.Add(JobAdminProfile); } dr.Close(); Cxn.Close(); } } } catch (SqlException ex) { throw; } return ListOfAllActiveJobs; }
// method for entering job details in database public bool InsertJobDetails(Job job) { bool result = false; try { using (SqlConnection Cxn = new SqlConnection(CxnString)) { using (SqlCommand Cmd = new SqlCommand("spCreateJob", Cxn)) { Cmd.CommandType = CommandType.StoredProcedure; /* (EmpID, Category, Company, Title, Location, JobDescription, Requirements, JobType, Terms, Salary, DateCreated) OUTPUT inserted.JobID INTO @IdInserted ///@jobid VALUES (@empid @type, @terms, @salary, @date) */ SqlParameter InsertEmpIDParam = new SqlParameter("@empid", SqlDbType.Int, 4); SqlParameter InsertJobCategoryParam = new SqlParameter("@category", SqlDbType.NVarChar, 50); SqlParameter InsertCompanyParam = new SqlParameter("@company", SqlDbType.NVarChar, 50); SqlParameter InsertJobTitleParam = new SqlParameter("@title", SqlDbType.NVarChar, 50); SqlParameter InsertLocationParam = new SqlParameter("@location", SqlDbType.NVarChar, 50); SqlParameter InsertJobDescriptionParam = new SqlParameter("@description", SqlDbType.NVarChar, 50); SqlParameter InsertRequirementsParam = new SqlParameter("@requirements", SqlDbType.NVarChar, 50); SqlParameter InsertJobTypeParam = new SqlParameter("@type", SqlDbType.NVarChar, 50); SqlParameter InsertJobTermsParam = new SqlParameter("@terms", SqlDbType.NVarChar, 50); SqlParameter InsertSalaryParam = new SqlParameter("@salary", SqlDbType.Decimal); SqlParameter InsertDateCreatedParam = new SqlParameter("@date", SqlDbType.DateTime); SqlParameter OutputJobIDParam = new SqlParameter("@jobid", SqlDbType.Int, 4); SqlParameter InsertLinkParam = new SqlParameter("@Link", SqlDbType.NVarChar, 50); InsertEmpIDParam.Value = job.EmpID; InsertJobCategoryParam.Value = job.Category; InsertCompanyParam.Value = job.Company; InsertJobTitleParam.Value = job.Title; InsertLocationParam.Value = job.Location; InsertJobDescriptionParam.Value = job.Description; InsertRequirementsParam.Value = job.Requirements; InsertJobTypeParam.Value = job.Type; InsertJobTermsParam.Value = job.Terms; InsertSalaryParam.Value = job.Salary; InsertDateCreatedParam.Value = job.DateCreated; InsertLinkParam.Value = job.Link; OutputJobIDParam.Direction = ParameterDirection.Output; Cmd.Parameters.Add(InsertEmpIDParam); Cmd.Parameters.Add(InsertJobCategoryParam); Cmd.Parameters.Add(InsertCompanyParam); Cmd.Parameters.Add(InsertJobTitleParam); Cmd.Parameters.Add(InsertLocationParam); Cmd.Parameters.Add(InsertJobDescriptionParam); Cmd.Parameters.Add(InsertRequirementsParam); Cmd.Parameters.Add(InsertJobTypeParam); Cmd.Parameters.Add(InsertJobTermsParam); Cmd.Parameters.Add(InsertSalaryParam); Cmd.Parameters.Add(InsertDateCreatedParam); Cmd.Parameters.Add(InsertLinkParam); Cmd.Parameters.Add(OutputJobIDParam); Cxn.Open(); int i = Cmd.ExecuteNonQuery(); if(i > 0) { job.JobID = Convert.ToInt32(OutputJobIDParam.Value); result = true; } else { result = false; } Cxn.Close(); } } } catch (SqlException ex) { throw; } return result; }