📄 wagemanage.aspx.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_ProRes_WageManage : 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_Wage";
this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Wage");
this.GridView1.DataKeyNames = new string[] { "ID" };
this.GridView1.DataBind();
}
protected void btnFind_Click(object sender, EventArgs e)
{
if (this.txtKeyWord.Text == "")
{
Response.Write("<script language=javascript>alert('关键字不能为空!');location='WageManage.aspx'</script>");
return;
}
SqlData da = new SqlData();
string search = this.dropClass.SelectedValue;
switch (search)
{
case "ID":
da.BindData(this.GridView1, "Select * From tb_Wage Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
case "员工姓名":
da.BindData(this.GridView1, "Select * From tb_Wage Where Name Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
case "录入人员":
da.BindData(this.GridView1, "Select * From tb_Wage Where WriteInMan Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
default:
Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
break;
}
}
protected void lnkbtnAdd_Click1(object sender, EventArgs e)
{
this.Panel2.Visible = true;
this.Panel1.Visible = false;
}
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_Wage Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
case "员工姓名":
da.BindData(this.GridView1, "Select * From tb_Wage Where Name Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
case "录入人员":
da.BindData(this.GridView1, "Select * From tb_Wage Where WriteInMan Like '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
break;
default:
Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
break;
}
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlData da = new SqlData();
string cmdtxt = "DELETE FROM tb_Wage where ID='"+this.GridView1.DataKeys[e.RowIndex].Value+"'";
da.ExceSQL(cmdtxt);
Page_Load(sender, e);
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlData da = new SqlData();
string cmdtxt = "INSERT INTO tb_Wage(Name,BaseWage,Bonus,PayMent,WriteInMan)";
cmdtxt += " VALUES('"+this.txtName.Text+"','"+this.txtBaseWage.Text+"','"+this.txtBounds.Text+"'";
cmdtxt += ",'"+this.txtPayMent.Text+"','"+this.txtWriteIn.Text+"')";
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='WageManage.aspx'</script>");
CommonClass.WriteNote(this.txtName.Text,0,Session["UserName"].ToString());
}
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='WageManage.aspx'</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -