📄 personbaseinfo.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Hr
{
public class PersonBaseInfo : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btReplay;
protected System.Web.UI.WebControls.Button btReset;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.DropDownList ddlSex;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtEmail;
protected System.Web.UI.WebControls.TextBox txtPhone;
protected System.Web.UI.WebControls.TextBox txtAddress;
protected System.Web.UI.WebControls.TextBox txtAddrNum;
Hr.component.PersonApply myInfo=new Hr.component.PersonApply();
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack )
{
ShowInfo();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btReplay.Click += new System.EventHandler(this.btReplay_Click);
this.btReset.Click += new System.EventHandler(this.btReset_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ShowInfo()
{
DataRow myDr;
myDr=myInfo.GetPersonInfo(int.Parse(Session["UserId"].ToString()));
txtName.Text=myDr["name"].ToString();
ddlSex.Items.Clear();
ddlSex.Items.Add("男");
ddlSex.Items.Add("女");
ddlSex.DataBind();
if (myDr["sex"].ToString()=="男")
ddlSex.SelectedIndex=0;
else
ddlSex.SelectedIndex=1;
txtEmail.Text=myDr["email"].ToString();
txtPhone.Text=myDr["phone"].ToString();
txtAddress.Text=myDr["address"].ToString();
txtAddrNum.Text=myDr["addrNum"].ToString();
}
private void btReplay_Click(object sender, System.EventArgs e)
{
ArrayList CommAry=new ArrayList();
CommAry.Add(int.Parse(Session["UserId"].ToString()));
CommAry.Add(txtName.Text.Trim());
CommAry.Add(ddlSex.SelectedValue);
CommAry.Add(txtEmail.Text.Trim());
CommAry.Add(txtPhone.Text.Trim());
CommAry.Add(txtAddress.Text.Trim());
CommAry.Add(txtAddrNum.Text.Trim());
try
{
myInfo.UpdatePersonInfo(CommAry);
//Response.Redirect("main.aspx");
}
catch(Exception e1)
{
Response.Redirect("Error.aspx");
}
}
private void btReset_Click(object sender, System.EventArgs e)
{
txtName.Text="";
txtEmail.Text="";
txtPhone.Text="";
txtAddress.Text="";
txtAddrNum.Text="";
}
private void btShow_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -