bbs_editreply.aspx.cs

来自「网络企业信息管理系统」· CS 代码 · 共 52 行

CS
52
字号
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 BBS_BBS_EditReply : System.Web.UI.Page
{
    string strSql;
    WebService webService = new WebService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null || Session["UserLevel"] == null)
        {
            Response.Redirect("~/Error.aspx");
        }
        if (!Page.IsPostBack)
        {
            strSql = "SELECT z_BbsMessage.BM_Title, z_Reply.BBS_ID, z_Reply.Reply_ID, z_Reply.Reply_Content, z_Reply.Reply_AddPersonID FROM z_BbsMessage INNER JOIN z_Reply ON z_BbsMessage.BM_ID = z_Reply.BBS_ID WHERE z_Reply.Reply_ID = '" + Request.QueryString["rid"] + "';";
            DataTable table = webService.ExcuteSelect(strSql);
            this.lblTitle.Text = table.Rows[0]["BM_Title"].ToString();
            this.tbContent.Text = table.Rows[0]["Reply_Content"].ToString();
            if (table.Rows[0]["Reply_AddPersonID"].ToString() != Session["UserID"].ToString())
            {
                Response.Redirect("~/Error.aspx");
            }
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.tbContent.Text == "")
        {
            this.lblMsg.Text = "请填写完整信息!";
        }
        else
        {
            strSql = "Update z_Reply set Reply_Content = '" + this.tbContent.Text + "',Reply_ModifyDate='" + DateTime.Now + "' where Reply_ID='" + Request.QueryString["rid"] + "';";
            webService.ExcuteSql(strSql);
            Response.Redirect("BBS_Info.aspx?bid="+Request.QueryString["bid"]);
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("BBS_Info.aspx?bid=" + Request.QueryString["bid"]);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?