⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 operationnote.aspx.cs

📁 实现企业的管理的标准化
💻 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;

public partial class Module_SysInfo_OperationNote : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlData da = new SqlData();
        string cmdtxt1 = "select * from tb_LoginLog";
        string cmdtxt2 = "select * from tb_WorkDo";
        this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_LoginLog");
        this.GridView2.DataSource = da.ExceDS(cmdtxt2, "tb_WorkDo");
        this.GridView1.DataKeyNames = new string[] { "ID" };
        this.GridView2.DataKeyNames = new string[] { "ID"};
        this.GridView1.DataBind();
        this.GridView2.DataBind();
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        if (this.txtKeyWord.Text == "")
        {
            Response.Write("<script language=javascript>alert('关键字不能为空!');location='OperationNote.aspx'</script>");
            return;
        }

        SqlData da = new SqlData();
        string search = this.dropClass.SelectedValue;
        switch (search)
        {
            case "登录ID":
                da.BindData(this.GridView1, "Select * From tb_LoginLog Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
                break;
            case "登录账号":
                da.BindData(this.GridView1, "Select * From tb_LoginLog Where UserName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
                break;
            default:
                Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
                break;
        }
    }
    protected void lnkbtnAdd_Click1(object sender, EventArgs e)
    {
        this.Panel1.Visible = false;
        this.Panel2.Visible = true;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.TextBox1.Text == "")
        {
            Response.Write("<script language=javascript>alert('关键字不能为空!');location='javascript:history.go(-1)'</script>");
            return;
        }

        SqlData da = new SqlData();
        string search = this.DropDownList1.SelectedValue;
        switch (search)
        {
            case "用户ID":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where ID  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            case "登录账号":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where UserName  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            case "操作类型":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where OperationClass  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            default:
                Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
                break;
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        this.Panel1.Visible = true;
        this.Panel2.Visible = false;
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string cmdtxt = "DELETE FROM tb_LoginLog where ID='"+this.GridView1.DataKeys[e.RowIndex].Value+"'";
        SqlData da = new SqlData();
        if (da.ExceSQL(cmdtxt))
        {
            Response.Write("<script language=javascript>alert('操作成功!');location='OperationNote.aspx'</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
        }
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }
    }
    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_LoginLog Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
                break;
            case "登录账号":
                da.BindData(this.GridView1, "Select * From tb_LoginLog Where UserName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_LoginLog");
                break;
            default:
                Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
                break;
        }
    }
    protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView2.PageIndex = e.NewPageIndex;
        SqlData da = new SqlData();
        string search = this.DropDownList1.SelectedValue;
        switch (search)
        {
            case "用户ID":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where ID  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            case "登录账号":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where UserName  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            case "操作类型":
                da.BindData(this.GridView2, "Select * From tb_WorkDo Where OperationClass  Like  '%" + this.TextBox1.Text + "%'", "tb_Department");
                break;
            default:
                Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
                break;
        }
    }
    protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string cmdtxt = "DELETE FROM tb_WorkDo where ID='"+this.GridView2.DataKeys[e.RowIndex].Value+"'";
        SqlData da = new SqlData();
        if (da.ExceSQL(cmdtxt))
        {
            Response.Write("<script language=javascript>alert('操作成功!');location='OperationNote.aspx'</script>");
        }
        else
        {
            Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
        }
    }
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -