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

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_ProRes_WageManage : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.         if (Session["UserName"] != null)
  16.         {
  17.             if (Session["Popedom"].ToString() == "0")
  18.             {
  19.                 this.lnkbtnAdd.Visible = true;
  20.             }
  21.         }
  22.         else
  23.         {
  24.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  25.         }
  26.         SqlData da = new SqlData();
  27.         string cmdtxt1 = "select * from tb_Wage";
  28.         this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Wage");
  29.         this.GridView1.DataKeyNames = new string[] { "ID" };
  30.         this.GridView1.DataBind();
  31.     }
  32.     protected void btnFind_Click(object sender, EventArgs e)
  33.     {
  34.         if (this.txtKeyWord.Text == "")
  35.         {
  36.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='WageManage.aspx'</script>");
  37.             return;
  38.         }
  39.         SqlData da = new SqlData();
  40.         string search = this.dropClass.SelectedValue;
  41.         switch (search)
  42.         {
  43.             case "ID":
  44.                 da.BindData(this.GridView1, "Select * From tb_Wage Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  45.                 break;
  46.             case "员工姓名":
  47.                 da.BindData(this.GridView1, "Select * From tb_Wage Where Name Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  48.                 break;
  49.             case "录入人员":
  50.                 da.BindData(this.GridView1, "Select * From tb_Wage Where WriteInMan  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  51.                 break;
  52.             default:
  53.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  54.                 break;
  55.         }
  56.     }
  57.     protected void lnkbtnAdd_Click1(object sender, EventArgs e)
  58.     {
  59.         this.Panel2.Visible = true;
  60.         this.Panel1.Visible = false;
  61.     }
  62.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  63.     {
  64.         this.GridView1.PageIndex = e.NewPageIndex;
  65.         SqlData da = new SqlData();
  66.         string search = this.dropClass.SelectedValue;
  67.         switch (search)
  68.         {
  69.             case "ID":
  70.                 da.BindData(this.GridView1, "Select * From tb_Wage Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  71.                 break;
  72.             case "员工姓名":
  73.                 da.BindData(this.GridView1, "Select * From tb_Wage Where Name Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  74.                 break;
  75.             case "录入人员":
  76.                 da.BindData(this.GridView1, "Select * From tb_Wage Where WriteInMan  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Wage");
  77.                 break;
  78.             default:
  79.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  80.                 break;
  81.         }
  82.     }
  83.     protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
  84.     {
  85.         SqlData da = new SqlData();
  86.         string cmdtxt = "DELETE FROM tb_Wage where ID='"+this.GridView1.DataKeys[e.RowIndex].Value+"'";
  87.         da.ExceSQL(cmdtxt);
  88.         Page_Load(sender, e);
  89.     }
  90.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  91.     {
  92.         if (e.Row.RowType == DataControlRowType.DataRow)
  93.         {
  94.             ((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
  95.         }
  96.     }
  97.     protected void Button1_Click(object sender, EventArgs e)
  98.     {
  99.         SqlData da = new SqlData();
  100.         string cmdtxt = "INSERT INTO tb_Wage(Name,BaseWage,Bonus,PayMent,WriteInMan)";
  101.         cmdtxt += " VALUES('"+this.txtName.Text+"','"+this.txtBaseWage.Text+"','"+this.txtBounds.Text+"'";
  102.         cmdtxt += ",'"+this.txtPayMent.Text+"','"+this.txtWriteIn.Text+"')";
  103.         if (da.ExceSQL(cmdtxt))
  104.         {
  105.             Response.Write("<script language=javascript>alert('操作成功!');location='WageManage.aspx'</script>");
  106.             CommonClass.WriteNote(this.txtName.Text,0,Session["UserName"].ToString());
  107.         }
  108.         else
  109.         {
  110.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  111.         }
  112.     }
  113.     protected void btnBack_Click(object sender, EventArgs e)
  114.     {
  115.         Response.Write("<script>this.parent.rightFrame.location='WageManage.aspx'</script>");
  116.     }
  117. }