Exemple #1
0
        protected void ModifyMyComment_Button_Click(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                if (ModifyMyComment_TextBox.Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(Page, GetType(), "nocontent", "alert('请输入内容!');", true);
                    //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('请输入内容!');location.href='/aspx/Course.aspx?CourseID=" + courseid + "'</script>");
                }
                else
                {
                    Byte[] tags = new Byte[20];
                    Byte   a = 1, b = 0;;
                    for (int i = 1; i <= 6; i++)
                    {
                        tags[i - 1] = ((CheckBox)FindControl("MyCommentTagModify" + i.ToString() + "_CheckBox")).Checked == true ? a : b;
                    }

                    MessageInfo mycomment = new MessageInfo();
                    mycomment.UserID   = user.UserID;
                    mycomment.CourseID = course.CourseID;
                    mycomment.Content  = ModifyMyComment_TextBox.Text;
                    mycomment.Tags     = tags;
                    if (1 == mycomment.ChangeComment())
                    {
                        AllDataBind();
                    }
                    else
                    {
                        AllDataBind();
                        ScriptManager.RegisterStartupScript(Page, GetType(), "changefailed", "alert('修改失败');", true);
                    }
                }
            }
            else
            {
                HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>");
            }
        }