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

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. public partial class Module_SysInfo_OperationNote : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.         SqlData da = new SqlData();
  16.         string cmdtxt1 = "select * from tb_LoginLog";
  17.         string cmdtxt2 = "select * from tb_WorkDo";
  18.         this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_LoginLog");
  19.         this.GridView2.DataSource = da.ExceDS(cmdtxt2, "tb_WorkDo");
  20.         this.GridView1.DataKeyNames = new string[] { "ID" };
  21.         this.GridView2.DataKeyNames = new string[] { "ID"};
  22.         this.GridView1.DataBind();
  23.         this.GridView2.DataBind();
  24.     }
  25.     protected void btnFind_Click(object sender, EventArgs e)
  26.     {
  27.         if (this.txtKeyWord.Text == "")
  28.         {
  29.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='OperationNote.aspx'</script>");
  30.             return;
  31.         }
  32.         SqlData da = new SqlData();
  33.         string search = this.dropClass.SelectedValue;
  34.         switch (search)
  35.         {
  36.             case "登录ID":
  37.                 da.BindData(this.GridView1, "Select * From tb_LoginLog Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
  38.                 break;
  39.             case "登录账号":
  40.                 da.BindData(this.GridView1, "Select * From tb_LoginLog Where UserName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
  41.                 break;
  42.             default:
  43.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  44.                 break;
  45.         }
  46.     }
  47.     protected void lnkbtnAdd_Click1(object sender, EventArgs e)
  48.     {
  49.         this.Panel1.Visible = false;
  50.         this.Panel2.Visible = true;
  51.     }
  52.     protected void Button1_Click(object sender, EventArgs e)
  53.     {
  54.         if (this.TextBox1.Text == "")
  55.         {
  56.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='javascript:history.go(-1)'</script>");
  57.             return;
  58.         }
  59.         SqlData da = new SqlData();
  60.         string search = this.DropDownList1.SelectedValue;
  61.         switch (search)
  62.         {
  63.             case "用户ID":
  64.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where ID  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  65.                 break;
  66.             case "登录账号":
  67.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where UserName  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  68.                 break;
  69.             case "操作类型":
  70.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where OperationClass  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  71.                 break;
  72.             default:
  73.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  74.                 break;
  75.         }
  76.     }
  77.     protected void LinkButton1_Click(object sender, EventArgs e)
  78.     {
  79.         this.Panel1.Visible = true;
  80.         this.Panel2.Visible = false;
  81.     }
  82.     protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
  83.     {
  84.         string cmdtxt = "DELETE FROM tb_LoginLog where ID='"+this.GridView1.DataKeys[e.RowIndex].Value+"'";
  85.         SqlData da = new SqlData();
  86.         if (da.ExceSQL(cmdtxt))
  87.         {
  88.             Response.Write("<script language=javascript>alert('操作成功!');location='OperationNote.aspx'</script>");
  89.         }
  90.         else
  91.         {
  92.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  93.         }
  94.     }
  95.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  96.     {
  97.         if (e.Row.RowType == DataControlRowType.DataRow)
  98.         {
  99.             ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
  100.         }
  101.     }
  102.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  103.     {
  104.         this.GridView1.PageIndex = e.NewPageIndex;
  105.         SqlData da = new SqlData();
  106.         string search = this.dropClass.SelectedValue;
  107.         switch (search)
  108.         {
  109.             case "登录ID":
  110.                 da.BindData(this.GridView1, "Select * From tb_LoginLog Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
  111.                 break;
  112.             case "登录账号":
  113.                 da.BindData(this.GridView1, "Select * From tb_LoginLog Where UserName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
  114.                 break;
  115.             default:
  116.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  117.                 break;
  118.         }
  119.     }
  120.     protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
  121.     {
  122.         this.GridView2.PageIndex = e.NewPageIndex;
  123.         SqlData da = new SqlData();
  124.         string search = this.DropDownList1.SelectedValue;
  125.         switch (search)
  126.         {
  127.             case "用户ID":
  128.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where ID  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  129.                 break;
  130.             case "登录账号":
  131.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where UserName  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  132.                 break;
  133.             case "操作类型":
  134.                 da.BindData(this.GridView2, "Select * From tb_WorkDo Where OperationClass  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
  135.                 break;
  136.             default:
  137.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  138.                 break;
  139.         }
  140.     }
  141.     protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
  142.     {
  143.         string cmdtxt = "DELETE FROM tb_WorkDo where ID='"+this.GridView2.DataKeys[e.RowIndex].Value+"'";
  144.         SqlData da = new SqlData();
  145.         if (da.ExceSQL(cmdtxt))
  146.         {
  147.             Response.Write("<script language=javascript>alert('操作成功!');location='OperationNote.aspx'</script>");
  148.         }
  149.         else
  150.         {
  151.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  152.         }
  153.     }
  154.     protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
  155.     {
  156.         if (e.Row.RowType == DataControlRowType.DataRow)
  157.         {
  158.             ((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
  159.         }
  160.     }
  161. }