ServiceNote.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_Employee_Relation_ServiceNote : 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.lnkbtnAdd.Visible = true;
  21.             }
  22.         }
  23.         else
  24.         {
  25.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  26.         }
  27.         SqlData da = new SqlData();
  28.         string cmdtxt1 = "select * from tb_Cservice";
  29.         this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Cservice");
  30.         this.GridView1.DataKeyNames = new string[] { "ID" };
  31.         this.GridView1.DataBind();
  32.         if (!IsPostBack)
  33.         {
  34.             string cmdtxt2 = "select Distinct Name from tb_User";
  35.             SqlDataReader dr = da.ExceDr(cmdtxt2);
  36.             while (dr.Read())
  37.             {
  38.                 this.dropDepEmployee.Items.Add(dr["Name"].ToString());
  39.             }
  40.             dr.Close();
  41.             string cmdtxt3 = "select Distinct DepName from tb_Department";
  42.             SqlCommand Com = new SqlCommand(cmdtxt3, da.ExceCon());
  43.             SqlDataReader dr1 = Com.ExecuteReader();
  44.             while (dr1.Read())
  45.             {
  46.                 this.dropDepAbout.Items.Add(dr1["DepName"].ToString());
  47.             }
  48.             dr1.Close();
  49.         }  
  50.     }
  51.     protected void btnFind_Click(object sender, EventArgs e)
  52.     {
  53.         if (this.txtKeyWord.Text == "")
  54.         {
  55.             Response.Write("<script language=javascript>alert('关键字不能为空!');location='ServiceNote.aspx'</script>");
  56.             return;
  57.         }
  58.         SqlData da = new SqlData();
  59.         string search = this.dropClass.SelectedValue;
  60.         switch (search)
  61.         {
  62.             case "记录ID":
  63.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  64.                 break;
  65.             case "服务员工":
  66.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ServicePerson  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  67.                 break;
  68.             case "客户名称":
  69.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ClientName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  70.                 break;
  71.             default:
  72.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  73.                 break;
  74.         }
  75.     }
  76.     protected void lnkbtnAdd_Click1(object sender, EventArgs e)
  77.     {
  78.         this.Panel1.Visible = false;
  79.         this.Panel2.Visible = true;
  80.     }
  81.     protected void btnOK_Click(object sender, EventArgs e)
  82.     {
  83.         SqlData da = new SqlData();
  84.         string cmdtxt = "INSERT INTO tb_Cservice(QusDescription,ServiceStartTime,ServiceEndTime,WritePerson,ServicePerson";
  85.         cmdtxt +=",Progress,ClientName,DepName,PhoneAbout,ClientAddress,PostCode,ClientEmail,CommunionContent)";
  86.         cmdtxt += " VALUES('" + this.txtDescription.Text + "','" + this.txtStartTime.Text + "','" + this.txtEndTime.Text + "'";
  87.         cmdtxt += ",'" + this.dropDepEmployee.SelectedValue+ "','" + this.txtServicePerson.Text + "','" + this.txtProgress.Text + "'";
  88.         cmdtxt += ",'" + this.txtClientName.Text + "','" + this.dropDepAbout.Text + "','" + this.txtPhoneAbout.Text + "'";
  89.         cmdtxt += ",'" + this.txtClientAddress.Text + "','" + this.txtPostCode.Text + "','" + this.txtClientEmail.Text + "'";
  90.         cmdtxt += ",'" + this.txtComContent.Text + "')";
  91.         if (da.ExceSQL(cmdtxt))
  92.         {
  93.             Response.Write("<script language=javascript>alert('操作成功!');location='ServiceNote.aspx'</script>");
  94.             CommonClass.WriteNote(this.txtDescription.Text, 0, Session["UserName"].ToString());
  95.         }
  96.         else
  97.         {
  98.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  99.         }
  100.     }
  101.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  102.     {
  103.         this.GridView1.PageIndex = e.NewPageIndex;
  104.         SqlData da = new SqlData();
  105.         string search = this.dropClass.SelectedValue;
  106.         switch (search)
  107.         {
  108.             case "记录ID":
  109.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  110.                 break;
  111.             case "服务员工":
  112.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ServicePerson  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  113.                 break;
  114.             case "客户名称":
  115.                 da.BindData(this.GridView1, "Select * From tb_Cservice Where ClientName  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Cservice");
  116.                 break;
  117.             default:
  118.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  119.                 break;
  120.         }
  121.     }
  122.     protected void btnBack_Click(object sender, EventArgs e)
  123.     {
  124.         Response.Write("<script>this.parent.rightFrame.location='ServiceNote.aspx'</script>");
  125.     }
  126. }