Notice.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:4k
源码类别:
Email客户端
开发平台:
Visual C++
- 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;
- public partial class Module_Admin_SysInfo_AddNotice : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["UserName"] != null)
- {
- this.lnkbtnAdd.Visible = true;
- }
- else
- {
- Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
- }
- SqlData da = new SqlData();
- string cmdtxt1 = "select * from tb_Notice";
- this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_Notice");
- this.GridView1.DataKeyNames = new string[] { "ID" };
- this.GridView1.DataBind();
- }
- protected void btnOK_Click(object sender, EventArgs e)
- {
- string cmdtxt = "INSERT INTO tb_Notice(NoticeTitle,NoticeContent,NoticeTime,NoticePerson) values('"+this.txtSubject.Text+"'";
- cmdtxt += ",'"+CommonClass.HtmlEncode(this.txtContent.Text)+"','"+DateTime.Now+"','"+Session["UserName"].ToString()+"')";
- SqlData da = new SqlData();
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');location='Notice.aspx'</script>");
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
- }
- }
- protected void lnkbtnAdd_Click1(object sender, EventArgs e)
- {
- this.Panel2.Visible = false;
- this.Panel1.Visible = true;
- }
- protected void btnFind_Click(object sender, EventArgs e)
- {
- SqlData da = new SqlData();
- string search = this.dropClass.SelectedValue;
- switch (search)
- {
- case "公告ID":
- da.BindData(this.GridView1, "Select * From tb_Notice Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- case "公告主题":
- da.BindData(this.GridView1, "Select * From tb_Notice Where NoticeTitle Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- case "发表人":
- da.BindData(this.GridView1, "Select * From tb_Notice Where NoticePerson Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- 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_Notice Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- case "公告主题":
- da.BindData(this.GridView1, "Select * From tb_Notice Where NoticeTitle Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- case "发表人":
- da.BindData(this.GridView1, "Select * From tb_Notice Where NoticePerson Like '%" + this.txtKeyWord.Text + "%'", "tb_Notice");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- }