WorkSum.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. using System.Data.SqlClient;
  12. public partial class Module_Employee_ProRes_WorkSum : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (Session["UserName"] == null)
  17.         {
  18.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  19.         }
  20.         SqlData da = new SqlData();
  21.         string cmdtxt1 = "select * from tb_WorkSum";
  22.         this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_WorkSum");
  23.         this.GridView1.DataKeyNames = new string[] { "ID" };
  24.         this.GridView1.DataBind();
  25.         if (!IsPostBack)
  26.         {
  27.             string cmdtxt2 = "select Distinct Name from tb_User";
  28.             SqlDataReader dr = da.ExceDr(cmdtxt2);
  29.             while (dr.Read())
  30.             {
  31.                 this.dropSumMan.Items.Add(dr["Name"].ToString());
  32.             }
  33.             dr.Close();
  34.             string cmdtxt3 = "select Distinct DepName from tb_Department";
  35.             SqlDataReader dr2 = da.ExceDr(cmdtxt3);
  36.             while (dr2.Read())
  37.             {
  38.                 this.dropDepName.Items.Add(dr2["DepName"].ToString());
  39.             }
  40.             dr2.Close();
  41.         }  
  42.     }
  43.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  44.     {
  45.         this.GridView1.PageIndex = e.NewPageIndex;
  46.         SqlData da = new SqlData();
  47.         string search = this.dropClass.SelectedValue;
  48.         switch (search)
  49.         {
  50.             case "ID":
  51.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  52.                 break;
  53.             case "部门名称":
  54.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where DepName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  55.                 break;
  56.             case "总结人员":
  57.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where Name  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  58.                 break;
  59.             default:
  60.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  61.                 break;
  62.         }
  63.     }
  64.     protected void btnFind_Click(object sender, EventArgs e)
  65.     {
  66.         if (this.txtKeyWord.Text == "")
  67.         {
  68.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='WorkSum.aspx'</script>");
  69.             return;
  70.         }
  71.         SqlData da = new SqlData();
  72.         string search = this.dropClass.SelectedValue;
  73.         switch (search)
  74.         {
  75.             case "ID":
  76.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  77.                 break;
  78.             case "部门名称":
  79.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where DepName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  80.                 break;
  81.             case "总结人员":
  82.                 da.BindData(this.GridView1, "Select * From tb_WorkSum Where Name  Like  '%" + this.txtKeyWord.Text + "%'", "tb_WorkSum");
  83.                 break;
  84.             default:
  85.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  86.                 break;
  87.         }
  88.     }
  89.     protected void lnkbtnAdd_Click1(object sender, EventArgs e)
  90.     {
  91.         this.Panel1.Visible = false;
  92.         this.Panel2.Visible = true;
  93.     }
  94.     protected void btnOK_Click(object sender, EventArgs e)
  95.     {
  96.         string cmdtxt = "INSERT INTO tb_WorkSum(DepName,Name,StartTime,EndTime,DoWhat,FinishHow,WorkDescription) VALUES('" + this.dropDepName.SelectedValue + "'";
  97.         cmdtxt +=",'" + this.dropSumMan.SelectedValue + "','" + this.txtStartTime.Text + "','" + this.txtEndTime.Text + "','" + this.txtDoWhat.Text + "'";
  98.         cmdtxt += ",'" + this.txtFinishWhat.Text + "','" + this.txtContent.Text + "')";
  99.         SqlData da = new SqlData();
  100.         if (da.ExceSQL(cmdtxt))
  101.         {
  102.             CommonClass.WriteNote(this.txtDoWhat.Text, 0, Session["UserName"].ToString());
  103.             Response.Write("<script language=javascript>alert('操作成功!');location='WorkSum.aspx'</script>");
  104.         }
  105.         else
  106.         {
  107.             Response.Write("<script language=javascript>alert('操作失败!')</script>");
  108.         }
  109.     }
  110.     protected void btnBack_Click(object sender, EventArgs e)
  111.     {
  112.         Response.Write("<script>this.parent.rightFrame.location='WorkSum.aspx'</script>");
  113.     }
  114. }