예제 #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string        name = txtName.Text.Trim();
            SqlDataReader dt   = UsersBll.select(name);

            dt.Read();
            if (dt != null)
            {
                Name.Text     = dt[1].ToString().Trim();
                Password.Text = dt[2].ToString().Trim();
                Tel.Text      = dt[3].ToString().Trim();
                Sex.Text      = dt[4].ToString().Trim();
                Vip.Text      = dt[6].ToString().Trim();
                Admin.Text    = dt[7].ToString().Trim();
                img.ImageUrl  = dt[5].ToString().Trim();
                BindView();
            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindView();
         if (Request.QueryString["usersname"] != null)
         {
             string        name = Request.QueryString["usersname"].ToString().Trim();
             SqlDataReader dt   = UsersBll.select(name);
             dt.Read();
             if (dt != null)
             {
                 txtName.Text     = dt[1].ToString().Trim();
                 txtPassword.Text = dt[2].ToString().Trim();
                 txtTel.Text      = dt[3].ToString().Trim();
                 Sex.Text         = dt[4].ToString().Trim();
                 Image1.ImageUrl  = dt[5].ToString();
                 Vip.Text         = dt[6].ToString().Trim();
                 Admin.Text       = dt[7].ToString().Trim();
             }
         }
     }
 }
예제 #3
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();
                    }
                }
            }
        }