예제 #1
0
        public int AddComment(Comment c, string ajaxSessionKey)
        {
            CheckRequest(ajaxSessionKey);

            CommentManager cm = new CommentManager();
            c.CreationDate = DateTime.Now;
            c.Text = WebUtils.FormatHtml(c.Text);
            c.Status = Comment.CommentStatus.Approved;
            int ret = cm.AddComment(c);

            SignalAlertEmail sae = new SignalAlertEmail();
            sae.Send(c, c.SignalID);

            return ret;
        }
예제 #2
0
        public JsonObject GetComments(JsonObject pars)
        {
            CheckRequest(pars["ajaxSessionKey"].ToString());

            JsonObject ret = new JsonObject();
            CommentManager cm = new CommentManager();
            int totalRecords = 0;
            List<Comment> comments = cm.GetComments(Convert.ToInt32(pars["signalID"]), Convert.ToInt32(pars["offset"]),
                out totalRecords);

            if (comments.Count > 0)
            {
                CommentsList s = (CommentsList)new UserControl().LoadControl("/Includes/CommentsList.ascx");
                s.Populate(comments, totalRecords);
                ret["count"] = totalRecords;
                ret["html"] = WebUtils.RenderControlToString(s);
            }
            else
                ret["count"] = 0;

            return ret;
        }