📄 sendnote.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Module_Employee_Relation_SendNote : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] != null)
{
if (Session["Popedom"].ToString() == "0")
{
this.lnkbtnAdd.Visible = true;
}
}
else
{
Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
}
SqlData da = new SqlData();
if (!IsPostBack)
{
string cmdtxt1 = "select * from tb_SendMan";
this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_SendMan");
this.GridView1.DataKeyNames = new string[] { "ID" };
this.GridView1.DataBind();
string cmdtxt2 = "select Distinct Name from tb_User";
SqlDataReader dr = da.ExceDr(cmdtxt2);
while (dr.Read())
{
this.dropDepEmployee.Items.Add(dr["Name"].ToString());
}
dr.Close();
string cmdtxt3 = "select Distinct DepName from tb_Department";
SqlCommand Com = new SqlCommand(cmdtxt3, da.ExceCon());
SqlDataReader dr1 = Com.ExecuteReader();
while (dr1.Read())
{
this.dropDepAbout.Items.Add(dr1["DepName"].ToString());
}
dr.Close();
}
}
protected void btnFind_Click(object sender, EventArgs e)
{
if (this.txtKeyWord.Text == "")
{
Response.Write("<script language=javascript>alert('关键字不能为空!');location='SendNote.aspx'</script>");
return;
}
SqlData da = new SqlData();
string search = this.dropClass.SelectedValue;
switch (search)
{
case "记录ID":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
case "客户名称":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ClientName Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
case "服务员工":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ServicePerson Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
default:
Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
break;
}
}
protected void lnkbtnAdd_Click1(object sender, EventArgs e)
{
this.Panel1.Visible = false;
this.Panel2.Visible = true;
}
protected void btnOK_Click(object sender, EventArgs e)
{
SqlData da = new SqlData();
string cmdtxt = "INSERT INTO tb_SendMan(ClientName,ClientAddress,ServicePerson,PlanTime,StartTime,EndTime,PhoneAbout";
cmdtxt += ",PostCode,ClientEmail,NoticeContent,DepName) VALUES('"+this.txtClientName.Text+"','"+this.txtClientAddress.Text+"'";
cmdtxt += ",'" + this.dropDepEmployee.SelectedValue + "','" + this.txtPlanTime.Text +"天','"+this.txtStartTime.Text+"'";
cmdtxt += ",'"+this.txtEndTime.Text+"','"+this.txtPhoneAbout.Text+"','"+this.txtPostCode.Text+"','"+this.txtClientEmail.Text+"'";
cmdtxt += ",'"+this.txtComContent.Text+"','"+this.dropDepAbout.SelectedValue+"')";
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='SendNote.aspx'</script>");
CommonClass.WriteNote(this.txtClientName.Text, 0, Session["UserName"].ToString());
}
else
{
Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
SqlData da = new SqlData();
string search = this.dropClass.SelectedValue;
switch (search)
{
case "记录ID":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
case "客户名称":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ClientName Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
case "服务员工":
da.BindData(this.GridView1, "Select * From tb_SendMan Where ServicePerson Like '%" + this.txtKeyWord.Text + "%'", "tb_SendMan");
break;
default:
Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
break;
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Write("<script>this.parent.rightFrame.location='SendNote.aspx'</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -