示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Bindnc();
            int id;

            if (!IsPostBack)
            {
                try
                {
                    if (Request.QueryString["bcid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["bcid"].ToString());
                        if (BBS_CommentBll.deletebc(id) == 1)
                        {
                            Bindnc();
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
        }
示例#2
0
 //发表评论
 protected void pinglun_Click(object sender, EventArgs e)
 {
     if (Session["username"] != null)
     {
         try
         {
             int         id = Convert.ToInt32(Request.QueryString["bbsid"].ToString());
             BBS_Comment bc = new BBS_Comment();
             bc.BC_BBS_ID1     = id;
             bc.BC_Users_Name1 = Session["username"].ToString();
             bc.BC_Content1    = txtContent.Text;
             bc.BC_Time1       = DateTime.Now;
             if (BBS_CommentBll.addbc(bc) == 1)
             {
                 txtContent.Text = "";
                 ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('评论成功!');", true);
                 BingBC();
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('评论失败!');", true);
             }
         }
         catch (Exception ex)
         {
             Response.Write("错误原因:" + ex.Message);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,请先登录!');", true);
     }
 }
示例#3
0
        ////多级回复
        //protected void huifu1_Click(object sender, EventArgs e)
        //{
        //    Button bt = (Button)sender;
        //    if (Session["username"] != null)
        //    {
        //        try
        //        {
        //            Back_Comment_Back bcb = new Back_Comment_Back();
        //            bcb.BCBID1 = Int32.Parse((bt.Parent.FindControl("HiddenField2") as HiddenField).Value);
        //            bcb.BCB_Comment1 = (bt.Parent.FindControl("txtContent") as TextBox).Text;
        //            bcb.BCB_Time1 = DateTime.Now;
        //            bcb.BCB_Users_Name1 = Session["username"].ToString();
        //            if (Back_Comment_BackBll.addbcb(bcb) == 1)
        //            {
        //                txtContent.Text = "";
        //                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论成功!');", true);
        //                flag = true;
        //                BingBC();
        //            }
        //            else
        //            {
        //                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('回复评论失败!');", true);
        //            }
        //        }
        //        catch (Exception ex)
        //        {
        //            Response.Write("错误原因:" + ex.Message);
        //        }
        //    }
        //    else
        //    {
        //        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,请先登录!');", true);
        //    }
        //}
        protected void BingBC()
        {
            int       id = Convert.ToInt32(Request.QueryString["bbsid"].ToString());
            DataTable bc = BBS_CommentBll.bbsallbc(id);

            if (bc != null)
            {
                listView1.DataSource = bc;
                listView1.DataBind();
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //查询有关各职业帖子数量.
            num.Text  = BBSBll.bbs_num().ToString();
            num1.Text = BBSBll.class_num("德鲁伊").ToString();
            num2.Text = BBSBll.class_num("猎人").ToString();
            num3.Text = BBSBll.class_num("法师").ToString();
            num4.Text = BBSBll.class_num("圣骑士").ToString();
            num5.Text = BBSBll.class_num("牧师").ToString();
            num6.Text = BBSBll.class_num("战士").ToString();
            num7.Text = BBSBll.class_num("潜行者").ToString();
            num8.Text = BBSBll.class_num("萨满祭祀").ToString();
            num9.Text = BBSBll.class_num("术士").ToString();

            CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser();
            fileBrowser.BasePath = "../ckfinder/";  //设置CKFinder的基路径
            fileBrowser.SetupCKEditor(txtContent);



            Bindjinghua();
            //绑定帖子内容
            int id;

            if (!IsPostBack)
            {
                flag = true;
                if (Request.QueryString["bbsid"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["bbsid"].ToString());
                    SqlDataReader dt = BBSBll.selectbbs(id);
                    dt.Read();
                    if (dt != null)
                    {
                        txtTitle.Text   = dt[1].ToString().Trim();
                        txtTime.Text    = string.Format("{0:yyyy-MM-dd hh:mm}", dt[2]);
                        Content.Text    = dt[4].ToString();
                        Image1.ImageUrl = dt[3].ToString().Trim();
                        txtClass.Text   = dt[7].ToString().Trim();
                        txtName.Text    = dt[5].ToString().Trim();
                    }
                    BingBC();
                    //显示总共多少评论
                    Label1.Text = BBS_CommentBll.num(id).ToString();
                }
            }
        }
示例#5
0
 //绑定数据
 protected void Bindnc()
 {
     ListView1.DataSource = BBS_CommentBll.allbc();
     ListView1.DataBind();
 }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //新闻评论回复删除操作
            int id;

            if (!IsPostBack)
            {
                try
                {
                    if (Request.QueryString["ncid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["ncid"].ToString());
                        if (News_CommentaryBll.news_deletenc(id) == 1)
                        {
                            loginover.Visible   = true;
                            shuju.Visible       = true;
                            newscomment.Visible = true;
                            Bindnc();
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>");
                        }
                    }
                    if (Request.QueryString["ncbid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["ncbid"].ToString());
                        if (News_Comment_BackBLL.deletencb(id) == 1)
                        {
                            loginover.Visible       = true;
                            shuju.Visible           = true;
                            newscommentback.Visible = true;
                            Bindncb();

                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>");
                        }
                    }
                    if (Request.QueryString["bbsid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["bbsid"].ToString());
                        if (BBSBll.deletebbs(id) == 1)
                        {
                            loginover.Visible = true;
                            shuju.Visible     = true;
                            userbbs.Visible   = true;
                            Bindbbs();

                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除失败!');</script>");
                        }
                    }
                    if (Request.QueryString["bcid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["bcid"].ToString());
                        if (BBS_CommentBll.deletebc(id) == 1)
                        {
                            loginover.Visible  = true;
                            shuju.Visible      = true;
                            bbscomment.Visible = true;
                            Bindnbc();

                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>");
                        }
                    }
                    if (Request.QueryString["bcbid"] != null)
                    {
                        id = Convert.ToInt32(Request.QueryString["bcbid"].ToString());
                        if (BBS_Comment_BackBll.deletebcb(id) == 1)
                        {
                            loginover.Visible     = true;
                            shuju.Visible         = true;
                            bbscomentback.Visible = true;
                            Bindnbcb();
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>");
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除删除失败!');</script>");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
            if (Session["username"] != null)
            {
                login.Visible     = false;
                loginover.Visible = true;


                //如果用户名不为空,将用户信息绑定
                SqlDataReader dt = UsersBll.select(Session["username"].ToString());
                dt.Read();
                Img.ImageUrl   = dt[5].ToString();
                name.Text      = dt[1].ToString();
                password.Text  = dt[2].ToString();
                password1.Text = dt[2].ToString();
                Phone.Text     = dt[3].ToString();
                Sex.Text       = dt[4].ToString();
            }
            else
            {
                login.Visible     = true;
                loginover.Visible = false;
            }

            if (loginover.Visible == true)
            {
                updateuser.Visible = true;

                //根据页面传值显示不同的数据
                if (Request.QueryString["bbs"] != null || Request.QueryString["news"] != null || Request.QueryString["back"] != null)
                {
                    updateuser.Visible = false;
                    shuju.Visible      = true;
                    //新闻评论
                    if (Request.QueryString["news"] == "nc")
                    {
                        newscomment.Visible = true;
                        Bindnc();
                    }
                    //新闻评论回复
                    if (Request.QueryString["news"] == "ncb")
                    {
                        newscommentback.Visible = true;
                        Bindncb();
                    }
                    //发布帖子
                    if (Request.QueryString["bbs"] == "bbs")
                    {
                        userbbs.Visible = true;
                        Bindbbs();
                    }
                    //发布帖子下的评论
                    if (Request.QueryString["bbs"] == "bc")
                    {
                        bbscomment.Visible = true;
                        Bindnbc();
                    }
                    //发布帖子下评论的回复
                    if (Request.QueryString["bbs"] == "bcb")
                    {
                        bbscomentback.Visible = true;
                        Bindnbcb();
                    }

                    if (Request.QueryString["back"] == "bbs")
                    {
                        backbbs.Visible = true;
                        Bindnbcb();
                    }
                }
            }
        }