DeptInfo.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:5k
源码类别:
Email客户端
开发平台:
Visual C++
- 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 System.Data.SqlClient;
- public partial class Module_Employee_ProRes_DeptInfo : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["UserName"] != null)
- {
- if (Session["Popedom"].ToString() == "0")
- {
- this.lnkbtnAdd.Visible = true;
- }
- }
- else
- {
- Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
- }
- SqlData da = new SqlData();
- string cmdtxt1 = "select * from tb_Department";
- this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Department");
- this.GridView1.DataKeyNames = new string[] { "ID"};
- this.GridView1.DataBind();
- if (!IsPostBack)
- {
- string cmdtxt2 = "select Distinct Name from tb_User";
- SqlDataReader dr = da.ExceDr(cmdtxt2);
- while (dr.Read())
- {
- this.DropDownList1.Items.Add(dr["Name"].ToString());
- }
- dr.Close();
- }
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- this.GridView1.PageIndex = e.NewPageIndex;
- SqlData da = new SqlData();
- string search = this.dropClass.SelectedValue;
- switch (search)
- {
- case "部门ID":
- da.BindData(this.GridView1, "Select * From tb_Department Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- case "部门名称":
- da.BindData(this.GridView1, "Select * From tb_Department Where DepName Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- case "部门经理":
- da.BindData(this.GridView1, "Select * From tb_Department Where DepManager Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- protected void lnkbtnAdd_Click1(object sender, EventArgs e)
- {
- this.Panel3.Visible = false;
- this.Panel1.Visible = true;
- }
- protected void btnOK_Click(object sender, EventArgs e)
- {
- string cmdtxt = "INSERT INTO tb_Department(DepName,DepManager,DepPhone,DepBaseTime,DepPost,DepAddress,DepDescription) VALUES('" + this.txtDeptName.Text + "','" + this.DropDownList1.SelectedValue + "'";
- cmdtxt += ",'" + this.txtDeptPhone.Text + "','" + this.txtBaseTime.Text + "','" + this.txtPostCard.Text + "'";
- cmdtxt += ",'" + this.txtDeptAddress.Text + "','" + this.txtDescript.Text + "')";
- SqlData da = new SqlData();
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');location='DeptInfo.aspx'</script>");
- CommonClass.WriteNote(this.txtDeptName.Text, 0, Session["UserName"].ToString());
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
- }
- }
- protected void btnFind_Click(object sender, EventArgs e)
- {
- if (this.txtKeyWord.Text == "")
- {
- Response.Write("<script language=javascript>alert('关键字不能为空!');location='DeptInfo.aspx'</script>");
- return;
- }
- SqlData da = new SqlData();
- string search = this.dropClass.SelectedValue;
- switch (search)
- {
- case "部门ID":
- da.BindData(this.GridView1, "Select * From tb_Department Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- case "部门名称":
- da.BindData(this.GridView1, "Select * From tb_Department Where DepName Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- case "部门经理":
- da.BindData(this.GridView1, "Select * From tb_Department Where DepManager Like '%" + this.txtKeyWord.Text + "%'", "tb_Department");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- protected void btnBack_Click(object sender, EventArgs e)
- {
- Response.Write("<script>this.parent.rightFrame.location='DeptInfo.aspx'</script>");
- }
- }