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

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