protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
if(this.Request["option"]!=null)
{
if (this.Request["option"] == "add")
{
}
else
{
this.BindBranchInfo();
}
}
}
}
private void BindBranchInfo()
{
string strsql = "select tb_branchId, tb_branchName,effective
from
t_Branch
where
tb_branchId= '" + this.Request["cCode"].ToString() + "'";
DataTable dt = Db.GetDataTable(strsql);
this.TBX_Branchcode.Text = dt.Rows[0]["tb_branchId"].ToString();
this.TBX_Branchname.Text=dt.Rows[0]["tb_branchName"].ToString();
this.DDL_effective.SelectedValue = dt.Rows[0]["effective"].ToString();
}
protected void Btn_Save_Click(object sender, EventArgs e)
//保存部门信息
{
if (this.TBX_Branchname.Text == "")
{
Response.Write("<script language=javascript>alert('您还没有填写部门名称!')</script>");
}
else
{
string str = "";
if (this.Request["option"].ToString() == "add")
{
str = "insert into t_Branch(tb_branchId,tb_branchName,effective) values('" +TBX_Branchcode.Text+ "','" + this.TBX_Branchname.Text + "','" + this.DDL_effective.SelectedValue+ "')";
}
else
{
str = "update t_Branch
set tb_branchName='" + this.TBX_Branchname.Text + "' where
tb_branchId='"+this.Request["cCode"].ToString()+"'";
}
TowinCore.Db.ExecuteSQL(str);
Cls_Message.ShowPageMessage("操作成功!", this.Page);
}
}
if (this.Request["option"].ToString() == "add")这一行有错!