📄 departmanage.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 MODEL;
using BLL;
public partial class PersonManage_DepartManage : System.Web.UI.Page
{
public static int id=0;
BLL.DepartInfoManager departInfoManager = new BLL.DepartInfoManager();
protected void Page_Load(object sender, EventArgs e)
{
string tittleName = Request.QueryString["tittleName"].ToString();
if (!Page.IsClientScriptBlockRegistered("basescript"))
Page.RegisterClientScriptBlock("basescript", registerscript(tittleName));
if (!IsPostBack)
{
GridView1.DataSource = departInfoManager.GetAllModels();
GridView1.DataBind();
}
}
public string registerscript(string tittle)
{
string clientscript = string.Format(@"
<script language=""javascript"">
window.parent.document.all.lblTittlename.innerText='{0}';
window.parent.document.all.lblTittle.innerText='{1}';
</script>", tittle, tittle);
return clientscript;
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "cur=this.style.backgroundColor;this.style.backgroundColor='#ff9900'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=cur");
}
//GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
String name = e.CommandName;
id = Convert.ToInt32(e.CommandArgument);
if (name == "De")
{
BLL.DepartInfoManager departInfoManager = new BLL.DepartInfoManager();
departInfoManager.DeleteModelById(id);
Response.Redirect("DepartManage.aspx?tittleName=部门管理");
}
if (name == "Ed")
{
Response.Redirect("EitdDeprtManager.aspx?id=" + id);
}
}
protected void btnBaocunxiugai_Click(object sender, EventArgs e)
{
Response.Redirect("EitdDeprtManager.aspx");
}
protected string GetBranchName(string Branchid)
{
BranchInfoManager ranchName=new BranchInfoManager();
return ranchName.GetModelById(int.Parse(Branchid)).BranchName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -