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