⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addback.aspx.cs

📁 数据配置信息 登录数据库为sa 密码123 登录界面的用户信息:shichang 密码:sc
💻 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;


public partial class AddBack : System.Web.UI.Page
{
    
 BLL.Class1 bc = new BLL.Class1();

    private void Clea()
    {
        this.TextBox1.Text = "";

        this.Response.Write("<script>window.setTimeout('window.close()',0);</script>");
    }

    private void InsertBack()
    {
        
        
         string BackBody = this.TextBox1.Text;
         string UserName = Session["User"].ToString();
         DateTime tiem = DateTime.Now;
         int TextID = int.Parse(Session["TextID"].ToString());

         if (this.TextBox1.Text != null && this.TextBox1.Text != "")
         {


             if (bc.InsertBack(TextID, UserName, BackBody, tiem))
             {
                 this.Response.Write("<script>alert('回复成功!');</script>");
             }
             else
             {
                 this.Response.Write("<script>alert('出现未知错误,无法回复!');</script>");
             }
         }
         else
         {
             this.Response.Write("<script>alert('出现未知错误,无法回复!');</script>");
         }
      
        //Clea();
    }


    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            if ((Session["User"] != null))
            {
              
                this.Label1.Text = Session["User"].ToString();
                
                this.Button2.Attributes.Add("onclick", "window.close();");
            }
            else
            {
                this.Response.Write("<script>window.setTimeout('window.close()',1000);</script>");
                this.Response.Redirect("index.aspx");
                //this.Page.RegisterStartupScript("closewindow", "<script>window.close()</script>");
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        InsertBack();
        

        Clea();
    }
}

⌨️ 快捷键说明

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