WorkSumInfo.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_ProRes_WorkSumInfo : 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.Panel1.Visible = true;
  21.             }
  22.         }
  23.         else
  24.         {
  25.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  26.         }
  27.         if (!IsPostBack)
  28.         {
  29.             SqlData da = new SqlData();
  30.             string str = Request["ID"].ToString();
  31.             string cmdtxt1 = "select * from tb_WorkSum where ID='" + str + "'";
  32.             SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
  33.             SqlDataReader dr1 = Com1.ExecuteReader();
  34.             dr1.Read();
  35.             if (dr1.HasRows)
  36.             {
  37.                 this.txtStartTime.Text = Convert.ToDateTime(dr1["StartTime"]).ToString("yyyy-MM-dd");
  38.                 this.txtFinishWhat.Text = dr1["FinishHow"].ToString();
  39.                 this.txtEndTime.Text = Convert.ToDateTime(dr1["EndTime"]).ToString("yyyy-MM-dd");
  40.                 this.txtDoWhat.Text = dr1["DoWhat"].ToString();
  41.                 this.txtContent.Text = dr1["WorkDescription"].ToString();
  42.                 this.txtDepName.Text = dr1["DepName"].ToString();
  43.                 this.txtSumMan.Text = dr1["Name"].ToString();
  44.             }
  45.             dr1.Close();
  46.             string cmdtxt2 = "select * from tb_User";
  47.             SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
  48.             SqlDataReader dr2 = Com2.ExecuteReader();
  49.             while (dr2.Read())
  50.             {
  51.                 this.dropSumMan.Items.Add(dr2["Name"].ToString());
  52.             }
  53.             dr2.Close();
  54.             string cmdtxt3 = "select * from tb_Department";
  55.             SqlCommand Com3 = new SqlCommand(cmdtxt3, da.ExceCon());
  56.             SqlDataReader dr3 = Com3.ExecuteReader();
  57.             while (dr3.Read())
  58.             {
  59.                 this.dropDepName.Items.Add(dr3["DepName"].ToString());
  60.             }
  61.             dr3.Close();
  62.         }
  63.     }
  64.     protected void btnEdit_Click(object sender, EventArgs e)
  65.     {
  66.         this.Panel2.Visible = false;
  67.         this.Panel4.Visible = false;
  68.         this.Panel3.Visible = true;
  69.         this.Panel5.Visible = true;
  70.         this.btnSave.Enabled = true;
  71.         this.btnDelete.Enabled = true;
  72.         this.txtContent.ReadOnly = false;
  73.         this.txtDoWhat.ReadOnly = false;
  74.         this.txtEndTime.ReadOnly = false;
  75.         this.txtFinishWhat.ReadOnly = false;
  76.         this.txtStartTime.ReadOnly = false;
  77.     }
  78.     protected void btnDelete_Click(object sender, EventArgs e)
  79.     {
  80.         string cmdtxt = "DELETE FROM tb_WorkSum where ID='" + Request["ID"].ToString() + "'";
  81.         SqlData da = new SqlData();
  82.         if (da.ExceSQL(cmdtxt))
  83.         {
  84.             Response.Write("<script language=javascript>alert('操作成功!');this.parent.rightFrame.location='WorkSum.aspx'</script>");
  85.             CommonClass.WriteNote(this.txtDoWhat.Text, 2, Session["UserName"].ToString());
  86.         }
  87.         else
  88.         {
  89.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  90.         }      
  91.     }
  92.     protected void btnSave_Click(object sender, EventArgs e)
  93.     {
  94.         string cmdtxt = "Update tb_WorkSum set DepName='" + this.dropDepName.SelectedValue + "',Name='" + this.dropSumMan.SelectedValue + "'";
  95.         cmdtxt += ",StartTime='" + this.txtStartTime.Text + "',EndTime='" + this.txtEndTime.Text + "',DoWhat='" + this.txtDoWhat.Text + "'";
  96.         cmdtxt += ",FinishHow='" + this.txtFinishWhat.Text + "',WorkDescription='" + this.txtContent.Text + "' where ID='" + Request["ID"].ToString() + "'";
  97.         SqlData da = new SqlData();
  98.         if (da.ExceSQL(cmdtxt))
  99.         {
  100.             Response.Write("<script language=javascript>alert('操作成功!');location='WorkSum.aspx'</script>");
  101.             CommonClass.WriteNote(this.txtDoWhat.Text, 1, Session["UserName"].ToString());
  102.         }
  103.         else
  104.         {
  105.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  106.         }
  107.     }
  108.     protected void btnBack_Click(object sender, EventArgs e)
  109.     {
  110.         Response.Write("<script>this.parent.rightFrame.location='WorkSum.aspx'</script>");
  111.     }
  112. }