Rule.aspx.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:

Email客户端

开发平台:

Visual C++

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class Module_Employee_ProRes_Rules : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (Session["UserName"] != null)
  17.         {
  18.             if (Session["Popedom"].ToString() == "0")
  19.             {
  20.                 this.panVisible.Visible = true;
  21.                 if (this.txtRule.ReadOnly == true)
  22.                 {
  23.                     this.btnOK.Enabled = false;
  24.                 }
  25.             }
  26.         }
  27.         else
  28.         {
  29.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  30.         }
  31.         string cmdtxt = "SELECT * FROM tb_Rule";
  32.         SqlData da = new SqlData();
  33.         SqlCommand Com = new SqlCommand(cmdtxt,da.ExceCon());
  34.         SqlDataReader dr = Com.ExecuteReader();
  35.         dr.Read();
  36.         if (!IsPostBack)
  37.         {
  38.             if (dr.HasRows)
  39.             {
  40.                 this.TextBox1.Text = dr["RuleTitle"].ToString();
  41.                 this.txtRule.Text = dr["RuleContent"].ToString();
  42.             }
  43.         }
  44.     }
  45.     protected void btnAmend_Click(object sender, EventArgs e)
  46.     {
  47.         this.txtRule.BackColor = System.Drawing.Color.White;
  48.         this.TextBox1.BackColor = System.Drawing.Color.White;
  49.         this.txtRule.ReadOnly = false;
  50.         this.TextBox1.ReadOnly = false;
  51.         this.btnOK.Enabled = true;
  52.     }
  53.     protected void btnOK_Click(object sender, EventArgs e)
  54.     {
  55.         string SqlStr = "UPDATE tb_rule SET RuleTitle='"+this.TextBox1.Text+"',RuleContent='"+this.txtRule.Text+"',RuleTime='"+DateTime.Now+"',RulePerson='"+Session["Name"].ToString()+"'";
  56.         //Response.Write(SqlStr);
  57.         //Response.End();
  58.         SqlData da = new SqlData();
  59.         if (da.ExceSQL(SqlStr))
  60.         {
  61.             Response.Write("<script language=javascript>alert('操作成功!');location='javascript:history.go(-1)'</script>");
  62.         }
  63.         else
  64.         {
  65.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  66.         }
  67.     }
  68. }