ClientLinkInfo.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_ClientLinkInfo : 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_ClientLink 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.txtClientPhone.Text = dr1["ClientPhone"].ToString();
  38.                 this.txtCity.Text = dr1["City"].ToString();
  39.                 this.txtCounty.Text = dr1["Country"].ToString();
  40.                 this.txtEmail.Text = dr1["Email"].ToString();
  41.                 this.txtFax.Text = dr1["Fax"].ToString();
  42.                 this.txtName.Text = dr1["ClientName"].ToString();
  43.                 this.txtPostCode.Text = dr1["PostCode"].ToString();
  44.                 this.txtProvince.Text = dr1["Province"].ToString();
  45.                 this.dropClass1.SelectedValue = dr1["ClientClass"].ToString();
  46.                 this.dropName.SelectedValue = dr1["WriteInMan"].ToString();
  47.                 this.dropProperty.SelectedValue = dr1["ClientProperty"].ToString();
  48.                 this.dropRelation.SelectedValue = dr1["ClientRelation"].ToString();
  49.                 this.txtProName.Text = dr1["WriteInMan"].ToString();
  50.                 this.txtWriteInTime.Text = Convert.ToDateTime(dr1["WriteInTime"]).ToString("yyyy-MM-dd");
  51.             }
  52.             dr1.Close();
  53.             string cmdtxt2 = "select Distinct Name from tb_User";
  54.             SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
  55.             SqlDataReader dr2 = Com2.ExecuteReader();
  56.             while (dr2.Read())
  57.             {
  58.                 this.dropName.Items.Add(dr2["Name"].ToString());
  59.             }
  60.             dr2.Close();
  61.         }
  62.     }
  63.     protected void btnEdit_Click(object sender, EventArgs e)
  64.     {
  65.         this.txtCity.ReadOnly = false;
  66.         this.txtClientPhone.ReadOnly = false;
  67.         this.txtCounty.ReadOnly = false;
  68.         this.txtEmail.ReadOnly = false;
  69.         this.txtFax.ReadOnly = false;
  70.         this.txtName.ReadOnly = false;
  71.         this.txtPostCode.ReadOnly = false;
  72.         this.txtProvince.ReadOnly = false;
  73.         this.dropClass1.Enabled = true;
  74.         this.dropName.Enabled = true;
  75.         this.dropProperty.Enabled = true;
  76.         this.dropRelation.Enabled = true;
  77.         this.btnDelete.Enabled = true ;
  78.         this.btnSave.Enabled = true;
  79.         this.Panel2.Visible = false;
  80.         this.Panel3.Visible = true;
  81.     }
  82.     protected void btnDelete_Click(object sender, EventArgs e)
  83.     {
  84.         string cmdtxt = "DELETE FROM tb_ClientLink where ID='"+Request["ID"].ToString()+"'";
  85.         SqlData da = new SqlData();
  86.         if (da.ExceSQL(cmdtxt))
  87.         {
  88.             Response.Write("<script language=javascript>alert('操作成功!');location='ClientLink.aspx'</script>");
  89.             CommonClass.WriteNote(this.txtName.Text, 3, Session["UserName"].ToString());
  90.         }
  91.         else
  92.         {
  93.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  94.         }      
  95.     }
  96.     protected void btnSave_Click(object sender, EventArgs e)
  97.     {
  98.         SqlData da = new SqlData();
  99.         string cmdtxt = "UPDATE tb_ClientLink SET ClientName='" + this.txtName.Text + "',ClientClass='"+this.dropClass1.SelectedValue+"'";
  100.         cmdtxt += ",ClientProperty='" + this.dropProperty.SelectedValue + "',ClientPhone='" + this.txtClientPhone.Text + "',Email='" + this.txtEmail.Text + "'";
  101.         cmdtxt += ",Country='" + this.txtCounty.Text + "',Province='" + this.txtProvince.Text + "',City='" + this.txtCity.Text + "',PostCode='"+this.txtPostCode.Text+"'";
  102.         cmdtxt += ",WriteInMan='" + this.dropName.SelectedValue + "',ClientRelation='"+this.dropRelation.SelectedValue+"',Fax='" + this.txtFax.Text + "',WriteInTime='" + DateTime.Now + "' where ID='" + Request["ID"].ToString() + "'";
  103.         if (da.ExceSQL(cmdtxt))
  104.         {
  105.             Response.Write("<script language=javascript>alert('操作成功!');location='ClientLink.aspx'</script>");
  106.             CommonClass.WriteNote(this.txtName.Text, 1, Session["UserName"].ToString());
  107.         }
  108.         else
  109.         {
  110.             Response.Write("<script language=javascript>alert('操作失败!')</script>");
  111.         }      
  112.     }
  113.     protected void btnBack_Click(object sender, EventArgs e)
  114.     {
  115.         Response.Write("<script>this.parent.rightFrame.location='ClientLink.aspx'</script>");
  116.     }
  117. }