LeaveWordWrite.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;
- using System.Data.SqlClient;
- public partial class Module_ProRes_LeaveWordWrite : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["UserName"] != null)
- {
- this.labMan.Text = Session["UserName"].ToString();
- }
- this.dlBind();
- }
- protected void btnOK_Click(object sender, EventArgs e)
- {
- string cmdtxt = "INSERT INTO tb_LeaveWord(LeaveSubject,UserName,ReleaseTime,Content)";
- cmdtxt += " VALUES('"+this.txtSubject.Text+"','"+Session["UserName"].ToString()+"','"+DateTime.Now+"','"+this.txtContent.Text+"')";
- SqlData da = new SqlData();
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');location='LeaveWordWrite.aspx'</script>");
- CommonClass.WriteNote(this.txtSubject.Text, 0, Session["UserName"].ToString());
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!')</script>");
- }
- }
- protected void lnkbtnTop_Click(object sender, EventArgs e)
- {
- this.labNowPage.Text = "1";
- this.dlBind();
- }
- protected void lnkbtnPrve_Click(object sender, EventArgs e)
- {
- this.labNowPage.Text = Convert.ToString(Convert.ToInt32(this.labNowPage.Text) - 1);
- this.dlBind();
- }
- protected void lnkbtnNext_Click(object sender, EventArgs e)
- {
- this.labNowPage.Text = Convert.ToString(Convert.ToInt32(this.labNowPage.Text) + 1);
- this.dlBind();
- }
- protected void lnkbtnLast_Click(object sender, EventArgs e)
- {
- this.labNowPage.Text = this.labCount.Text;
- this.dlBind();
- }
- public void dlBind()
- {
- int curpage = Convert.ToInt32(labNowPage.Text);
- PagedDataSource ps = new PagedDataSource();
- SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]);
- mycon.Open();
- string cmdtxt = null;
- if (Request["ID"] != null)
- {
- cmdtxt = "SELECT * FROM tb_FeedBack WHERE LeaveWordID='" + Request["ID"].ToString() + "'";
- }
- else
- {
- cmdtxt = "SELECT * FROM tb_LeaveWord WHERE UserName='"+Session["UserName"].ToString()+"'";
- }
- SqlDataAdapter MyAdapter = new SqlDataAdapter(cmdtxt, mycon);
- DataSet ds = new DataSet();
- MyAdapter.Fill(ds, "tb_LeaveWord");
- ps.DataSource = ds.Tables["tb_LeaveWord"].DefaultView;
- ps.AllowPaging = true; //是否可以分页
- ps.PageSize = 3; //显示的数量
- ps.CurrentPageIndex = curpage - 1; //取得当前页的页码
- lnkbtnPrve.Enabled = true;
- lnkbtnTop.Enabled = true;
- lnkbtnNext.Enabled = true;
- lnkbtnLast.Enabled = true;
- if (curpage == 1)
- {
- lnkbtnTop.Enabled = false;//不显示第一页按钮
- lnkbtnPrve.Enabled = false;//不显示上一页按钮
- }
- if (curpage == ps.PageCount)
- {
- lnkbtnNext.Enabled = false;//不显示下一页
- lnkbtnLast.Enabled = false;//不显示最后一页
- }
- this.labCount.Text = Convert.ToString(ps.PageCount);
- this.DataList1.DataSource = ps;
- this.DataList1.DataKeyField = "ID";
- this.DataList1.DataBind();
- }
- protected void lnkbtnAdd_Click(object sender, EventArgs e)
- {
- this.Panel1.Visible = false;
- this.Panel2.Visible = true;
- }
- }