SendInfo.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_Relation_SendInfo : 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_SendMan 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.txtClientAddress.Text = dr1["ClientAddress"].ToString();
  38.                 this.txtClientEmail.Text = dr1["ClientEmail"].ToString();
  39.                 this.txtClientName.Text = dr1["ClientName"].ToString();
  40.                 this.txtComContent.Text = dr1["NoticeContent"].ToString();
  41.                 this.txtEndTime.Text = Convert.ToDateTime(dr1["EndTime"]).ToString("yyyy-MM-dd");
  42.                 this.txtPhoneAbout.Text = dr1["PhoneAbout"].ToString();
  43.                 this.txtPostCode.Text = dr1["PostCode"].ToString();
  44.                 this.txtEmployee.Text = dr1["ServicePerson"].ToString();
  45.                 this.txtDepName.Text = dr1["DepName"].ToString();
  46.                 this.txtPlanTime.Text = dr1["PlanTime"].ToString();
  47.                 this.txtStartTime.Text = Convert.ToDateTime(dr1["StartTime"]).ToString("yyyy-MM-dd");
  48.             }
  49.             dr1.Close();
  50.             string cmdtxt2 = "select Distinct Name from tb_User";
  51.             SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
  52.             SqlDataReader dr2 = Com2.ExecuteReader();
  53.             while (dr2.Read())
  54.             {
  55.                 this.dropDepEmployee.Items.Add(dr2["Name"].ToString());
  56.             }
  57.             dr2.Close();
  58.             string cmdtxt3 = "select Distinct DepName from tb_Department";
  59.             SqlCommand Com = new SqlCommand(cmdtxt3, da.ExceCon());
  60.             SqlDataReader dr3 = Com.ExecuteReader();
  61.             while (dr3.Read())
  62.             {
  63.                 this.dropDepAbout.Items.Add(dr3["DepName"].ToString());
  64.             }
  65.             dr3.Close();
  66.         }
  67.     }
  68.     protected void btnDelete_Click(object sender, EventArgs e)
  69.     {
  70.         string cmdtxt = "DELETE FROM tb_SendMan where ID='" + Request["ID"].ToString() + "'";
  71.         SqlData da = new SqlData();
  72.         if (da.ExceSQL(cmdtxt))
  73.         {
  74.             Response.Write("<script language=javascript>alert('操作成功!');location='SendNote.aspx'</script>");
  75.         }
  76.         else
  77.         {
  78.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  79.         }      
  80.     }
  81.     protected void btnEdit_Click(object sender, EventArgs e)
  82.     {
  83.         this.txtClientAddress.ReadOnly = false;
  84.         this.txtClientEmail.ReadOnly = false;
  85.         this.txtClientName.ReadOnly = false;
  86.         this.txtComContent.ReadOnly = false;
  87.         this.txtDepName.ReadOnly = false;
  88.         this.txtEmployee.ReadOnly = false;
  89.         this.txtEndTime.ReadOnly = false;
  90.         this.txtPhoneAbout.ReadOnly = false;
  91.         this.txtPlanTime.ReadOnly = false;
  92.         this.txtPostCode.ReadOnly = false;
  93.         this.txtStartTime.ReadOnly = false;
  94.         this.btnDelete.Enabled = true;
  95.         this.btnSave.Enabled = true;
  96.         this.Panel2.Visible = false;
  97.         this.Panel3.Visible = true;
  98.         this.Panel4.Visible = false;
  99.         this.Panel5.Visible = true;
  100.     }
  101.     protected void btnSave_Click(object sender, EventArgs e)
  102.     {
  103.         SqlData da = new SqlData();
  104.         string cmdtxt = "UPDATE tb_SendMan SET ClientName='" + this.txtClientName.Text + "',ClientAddress='" + this.txtClientAddress.Text + "'";
  105.         cmdtxt += ",ServicePerson='" + this.dropDepEmployee.SelectedValue + "',PlanTime='" + this.txtPlanTime.Text + "'";
  106.         cmdtxt += ",StartTime='" + this.txtStartTime.Text + "',EndTime='" + this.txtEndTime.Text + "',PhoneAbout='" + this.txtPhoneAbout.Text + "'";
  107.         cmdtxt += ",PostCode='" + this.txtPostCode.Text + "',ClientEmail='" + this.txtClientEmail.Text + "',NoticeContent='" + this.txtComContent.Text + "'";
  108.         cmdtxt += ",DepName='"+this.dropDepAbout.SelectedValue+"' WHERE ID='"+Request["ID"].ToString()+"'";
  109.         if (da.ExceSQL(cmdtxt))
  110.         {
  111.             Response.Write("<script language=javascript>alert('操作成功!');location='SendNote.aspx'</script>");
  112.             CommonClass.WriteNote(this.txtClientName.Text, 1, Session["UserName"].ToString());
  113.         }
  114.         else
  115.         {
  116.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  117.         }
  118.     }
  119.     protected void btnBack_Click(object sender, EventArgs e)
  120.     {
  121.         Response.Write("<script>this.parent.rightFrame.location='SendNote.aspx'</script>");
  122.     }
  123. }