Task.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_DeptTask : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (Session["UserName"] != null)
  17.         {
  18.             if (Session["Popedom"].ToString() == "0")
  19.             {
  20.                 this.lnkbtnAdd.Visible = true;
  21.             }
  22.         }
  23.         else
  24.         {
  25.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  26.         }
  27.         SqlData da = new SqlData();
  28.         if (!IsPostBack)
  29.         {
  30.             string cmdtxt1 = "select Distinct Name from tb_User";
  31.             string cmdtxt2 = "select Distinct DepName from tb_Department";
  32.             SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
  33.             SqlDataReader dr1 = Com1.ExecuteReader();
  34.             while (dr1.Read())
  35.             {
  36.                 this.dropRePro.Items.Add(dr1["Name"].ToString());
  37.             }
  38.             dr1.Close();
  39.             SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
  40.             SqlDataReader dr2 = Com2.ExecuteReader();
  41.             while (dr2.Read())
  42.             {
  43.                 this.dropAcceptPro.Items.Add(dr2["DepName"].ToString());
  44.             }
  45.             dr2.Close();
  46.         }
  47.         string cmdtxt3 = "select * from tb_DepTask";
  48.         da.BindData(this.GridView1, cmdtxt3, "tb_DepTask");
  49.     }
  50.     protected void btnOK_Click(object sender, EventArgs e)
  51.     {
  52.         SqlData da = new SqlData();
  53.         string cmdtxt = "INSERT INTO tb_DepTask(TaskDescription,DepName,ReleaseTime,StartTime,EndTime,IsMain,ReleasePerson,CompletePitch)";
  54.         cmdtxt += " VALUES('"+this.txtDescription.Text+"','"+this.dropAcceptPro.SelectedValue+"','"+DateTime.Now+"','"+this.txtStartTime.Text+"'";
  55.         cmdtxt += ",'" + this.txtEndTime.Text + "','" + this.dropImport.SelectedValue + "','" + this.dropRePro.SelectedValue + "','" + this.txtComPitch.Text + "')";
  56.         if (da.ExceSQL(cmdtxt))
  57.         {
  58.             Response.Write("<script language=javascript>alert('操作成功!');location='Task.aspx'</script>");
  59.             CommonClass.WriteNote(this.txtDescription.Text, 0, Session["UserName"].ToString());
  60.         }
  61.         else
  62.         {
  63.             Response.Write("<script language=javascript>alert('操作失败!')</script>");
  64.         }
  65.     }
  66.     protected void btnFind_Click(object sender, EventArgs e)
  67.     {
  68.         if (this.txtKeyWord.Text == "")
  69.         {
  70.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='Task.aspx'</script>");
  71.             return;
  72.         }
  73.         SqlData da = new SqlData();
  74.         string search = this.dropClass.SelectedValue;
  75.         switch (search)
  76.         {
  77.             case "任务ID":
  78.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  79.                 break;
  80.             case "接受者":
  81.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where DepName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  82.                 break;
  83.             case "下达者":
  84.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where ReleasePerson  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  85.                 break;
  86.             default:
  87.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='TaskAllInfo.aspx'</script>");
  88.                 break;
  89.         }
  90.     }
  91.     protected void lnkbtnAdd_Click1(object sender, EventArgs e)
  92.     {
  93.         this.Panel1.Visible = false;
  94.         this.Panel2.Visible = true;
  95.     }
  96.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  97.     {
  98.         this.GridView1.PageIndex = e.NewPageIndex;
  99.         SqlData da = new SqlData();
  100.         string search = this.dropClass.SelectedValue;
  101.         switch (search)
  102.         {
  103.             case "任务ID":
  104.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  105.                 break;
  106.             case "接受者":
  107.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where DepName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  108.                 break;
  109.             case "下达者":
  110.                 da.BindData(this.GridView1, "Select * From tb_DepTask Where ReleasePerson  Like  '%" + this.txtKeyWord.Text + "%'", "tb_DepTask");
  111.                 break;
  112.             default:
  113.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='Task.aspx'</script>");
  114.                 break;
  115.         }
  116.     }
  117.     protected void btnBack_Click(object sender, EventArgs e)
  118.     {
  119.         Response.Write("<script>this.parent.rightFrame.location='Task.aspx'</script>");
  120.     }
  121. }