CommunionNote.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_Employee_Relation_CourseNote : 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_Ccommunion";
  29.         this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Ccommunion");
  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.             dr.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='CommunionNote.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_Ccommunion Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  64.                 break;
  65.             case "交流主题":
  66.                 da.BindData(this.GridView1, "Select * From tb_Ccommunion Where Subject  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  67.                 break;
  68.             case "相关客户":
  69.                 da.BindData(this.GridView1, "Select * From tb_Ccommunion Where ClientAbout  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  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 GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  82.     {
  83.         this.GridView1.PageIndex = e.NewPageIndex;
  84.         SqlData da = new SqlData();
  85.         string search = this.dropClass.SelectedValue;
  86.         switch (search)
  87.         {
  88.             case "记录ID":
  89.                 da.BindData(this.GridView1, "Select * From tb_Ccommunion Where ID  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  90.                 break;
  91.             case "交流主题":
  92.                 da.BindData(this.GridView1, "Select * From tb_Ccommunion Where Subject  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  93.                 break;
  94.             case "相关客户":
  95.                 da.BindData(this.GridView1, "Select * From tb_Ccommunion Where ClientAbout  Like  '%" + this.txtKeyWord.Text + "%'", "tb_Ccommunion");
  96.                 break;
  97.             default:
  98.                 Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
  99.                 break;
  100.         }
  101.     }
  102.     protected void btnOK_Click(object sender, EventArgs e)
  103.     {
  104.         SqlData da = new SqlData();
  105.         string cmdtxt = "INSERT INTO tb_Ccommunion(Subject,CommunionTime,ClientAbout,LinkMan,DepAbout";
  106.         cmdtxt +=",DepEmployee,PhoneAbout,WriteTime,ClientAddress,PostCode,ClientEmail,CommunionContent)";
  107.         cmdtxt += " VALUES('"+this.txtSubject.Text+"','"+this.txtComTime.Text+"','"+this.txtClientAbout.Text+"'";
  108.         cmdtxt += ",'"+this.txtLinkMan.Text+"','"+this.dropDepAbout.SelectedValue+"','"+this.dropDepEmployee.SelectedValue+"'";
  109.         cmdtxt += ",'"+this.txtPhoneAbout.Text+"','"+DateTime.Now+"','"+this.txtClientAddress.Text+"','"+this.txtPostCode.Text+"'";
  110.         cmdtxt += ",'"+this.txtClientEmail.Text+"','"+this.txtComContent.Text+"')";
  111.         if (da.ExceSQL(cmdtxt))
  112.         {
  113.             Response.Write("<script language=javascript>alert('操作成功!');location='CommunionNote.aspx'</script>");
  114.             CommonClass.WriteNote(this.txtSubject.Text, 0, Session["UserName"].ToString());
  115.         }
  116.         else
  117.         {
  118.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  119.         }
  120.     }
  121.     protected void btnBack_Click(object sender, EventArgs e)
  122.     {
  123.         Response.Write("<script>this.parent.rightFrame.location='CommunionNote.aspx'</script>");
  124.     }
  125. }