📄 viewjobposting.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using JobSiteStarterKit.BOL;
public partial class viewjobposting_aspx : Page
{
protected void Page_Load(object sender, EventArgs e)
{
//判断用户是否属于jobseeker角色
if (!Roles.IsUserInRole(ConfigurationManager.AppSettings["jobseekerrolename"]))
{
Response.Redirect("~/customerrorpages/NotAuthorized.aspx");
}
if (!Page.IsPostBack)
{
//从查询字符串中获取指定的职位ID号
int postingid;
postingid = int.Parse(Request.QueryString["id"]);
//调用JobPosting的静态方法GetPosting获取指定的职位信息
JobPosting p=JobPosting.GetPosting(postingid);
lblCity.Text = p.City;
//获取指定指位名称
lblCompany.Text = Company.GetCompanyName(p.CompanyID);
//将LinkButton按钮的CommandArgument参数设置为指定的公司ID
btnViewProfile.CommandArgument=p.CompanyID.ToString();
lblContactPerson.Text = p.ContactPerson;
//获取指定的国家名称
lblCountry.Text = Country.GetCountryName(p.CountryID);
lblDept.Text = p.Department;
lblDesc.Text = p.Description;
//获取教育程度名称
lblEduLevel.Text = EducationLevel.GetEducationLevelName(p.EducationLevelID);
lblJobCode.Text = p.JobCode;
//获取工作类型名称
lblJobType.Text = JobType.GetJobTypeName(p.JobTypeID);
lblMaxSal.Text = p.MaxSalary.ToString("C");
lblMinSal.Text = p.MinSalary.ToString("C");
lblPostDt.Text = p.PostingDate.ToShortDateString();
//获取指定省的名称
lblState.Text = State.GetStateName(p.StateID);
lblTitle.Text = p.Title;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/" + ConfigurationManager.AppSettings["jobseekerfolder"] + "/jobsearch.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
//新建一个MyJob对象实例
MyJob j = new MyJob();
//为 PostingID赋值
j.PostingID = int.Parse(Request.QueryString["id"]);
j.UserName = Profile.UserName;
//插入这个新的MyObject实例
MyJob.Insert(j);
}
protected void btnViewProfile_Click(object sender, EventArgs e)
{
Response.Redirect("~/" + ConfigurationManager.AppSettings["jobseekerfolder"] + "/viewcompanyprofile.aspx?id=" + btnViewProfile.CommandArgument);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -