DeptAllInfo.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:4k
源码类别:
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_ProRes_DeptAllInfo : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["UserName"] != null)
- {
- if (Session["Popedom"].ToString() == "0")
- {
- this.Panel1.Visible = true;
- }
- }
- else
- {
- Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
- }
- if (!IsPostBack)
- {
- SqlData da = new SqlData();
- string str = Request["ID"].ToString();
- string cmdtxt1 = "select * from tb_Department where ID='" + str + "'";
- SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
- SqlDataReader dr1 = Com1.ExecuteReader();
- dr1.Read();
- if (dr1.HasRows)
- {
- this.txtDeptName.Text = dr1["DepName"].ToString();
- this.txtDeptManager.Text = dr1["DepManager"].ToString();
- this.txtDeptAddress.Text = dr1["DepAddress"].ToString();
- this.txtDeptPhone.Text = dr1["DepPhone"].ToString();
- this.txtDescript.Text = dr1["DepDescription"].ToString();
- this.txtPostCard.Text = dr1["DepPost"].ToString();
- this.txtBaseTime.Text = Convert.ToDateTime(dr1["DepBaseTime"]).ToString("yyyy-MM-dd");
- }
- dr1.Close();
- string cmdtxt2 = "select * from tb_User";
- SqlCommand Com2 = new SqlCommand(cmdtxt2,da.ExceCon());
- SqlDataReader dr2 = Com2.ExecuteReader();
- while (dr2.Read())
- {
- this.DropDownList1.Items.Add(dr2["Name"].ToString());
- }
- dr2.Close();
- }
- }
- protected void btnEdit_Click(object sender, EventArgs e)
- {
- this.Panel2.Visible = false;
- this.Panel3.Visible = true;
- this.btnSave.Enabled = true ;
- this.btnDelete.Enabled = true;
- this.txtBaseTime.ReadOnly = false;
- this.txtDeptAddress.ReadOnly = false;
- this.txtDeptPhone.ReadOnly = false;
- this.txtDescript.ReadOnly = false;
- this.txtPostCard.ReadOnly = false;
- }
- protected void btnSave_Click(object sender, EventArgs e)
- {
- string cmdtxt = "Update tb_Department set DepName='" + this.txtDeptName.Text + "',DepManager='" + this.DropDownList1.SelectedValue + "'";
- cmdtxt += ",DepPhone='" + this.txtDeptPhone.Text + "',DepBaseTime='" + this.txtBaseTime.Text + "',DepPost='" + this.txtPostCard.Text + "'";
- cmdtxt += ",DepAddress='" + this.txtDeptAddress.Text + "',DepDescription='" + this.txtDescript.Text + "' where ID='"+Request["ID"].ToString()+"'";
- SqlData da = new SqlData();
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');location='DeptInfo.aspx'</script>");
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
- }
- }
- protected void btnDelete_Click(object sender, EventArgs e)
- {
- string cmdtxt = "DELETE FROM tb_Department where ID='"+Request["ID"].ToString()+"'";
- SqlData da = new SqlData();
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');this.parent.rightFrame.location='DeptInfo.aspx'</script>");
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
- }
- }
- protected void btnBack_Click(object sender, EventArgs e)
- {
- Response.Write("<script>this.parent.rightFrame.location='DeptInfo.aspx'</script>");
- }
- }