Пример #1
0
        public static string comment(string desc, string id)
        {
            Comment cm = new Comment();

            try
            {
                if (cm.Addcomment(desc, Utils.CIntDef(id)))
                {
                    return("success");
                }
                return("errors");
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return("errors");
            }
        }
        protected void Rpcomment_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Reply":
                Literal lbReplyError  = e.Item.FindControl("lbReplyError") as Literal;
                TextBox txtQuickReply = e.Item.FindControl("txtQuickReply") as TextBox;
                if (txtQuickReply.Text == "")
                {
                    lbReplyError.Text = "Nội dung trả lời không được rỗng";
                }
                else
                {
                    int _newsID   = Utils.CIntDef(Session["news_id"]);
                    int commentId = Utils.CIntDef(e.CommandArgument);
                    cm.Addcomment(txtQuickReply.Text, _newsID, commentId);
                    txtQuickReply.Text = "";
                    lbReplyError.Text  = "";
                    Repeater Repeater1 = e.Item.FindControl("Repeater1") as Repeater;
                    Repeater1.DataSource = Load_Reply(e.CommandArgument);
                    Repeater1.DataBind();
                    //Response.Redirect(Request.RawUrl + "#list-comment");
                }
                break;

            case "Thank":
                LinkButton btnThankreply = e.Item.FindControl("btnThankreply") as LinkButton;
                Label      lbThank       = e.Item.FindControl("lbThank") as Label;
                btnThankreply.Visible = false;
                lbThank.Text          = "Bạn đã cảm ơn nhận xét này";
                lbThank.ForeColor     = System.Drawing.Color.Green;
                break;

            default:
                break;
            }
        }