Exemple #1
0
        private static data.Comment CreateComment(WebComment comment, Member member)
        {
            var inReplyToCommentID = comment.InReplyToCommentID;
            var inReplyToComment   = inReplyToCommentID == 0 ? null : data.Comment.GetComment(inReplyToCommentID);

            var result = new data.Comment()
            {
                ObjectID       = comment.ObjectID,
                MemberIDFrom   = member.MemberID,
                Text           = HttpUtility.HtmlEncode(comment.Text),
                DTCreated      = DateTime.Now,
                IsDeleted      = false,
                CommentType    = comment.CommentType,
                WebCommentID   = UniqueID.NewWebID(),
                Path           = inReplyToComment == null ? "/" : String.Format("/{0}/", inReplyToComment.InReplyToCommentID),
                SentFromMobile = 1
            };

            result.Save();

            result.ThreadNo           = inReplyToComment == null ? result.CommentID : inReplyToComment.ThreadNo;
            result.InReplyToCommentID = inReplyToCommentID == 0 ? result.CommentID : inReplyToCommentID;
            result.Save();

            try
            {
                IncrementCommentCount((CommentType)comment.CommentType, comment.ObjectID);
            }
            catch { }

            return(result);
        }
        private static data.Comment CreateComment(WebComment comment, Member member)
        {
            var inReplyToCommentID = comment.InReplyToCommentID;
            var inReplyToComment = inReplyToCommentID == 0 ? null : data.Comment.GetComment(inReplyToCommentID);

            var result = new data.Comment()
            {
                ObjectID = comment.ObjectID,
                MemberIDFrom = member.MemberID,
                Text = HttpUtility.HtmlEncode(comment.Text),
                DTCreated = DateTime.Now,
                IsDeleted = false,
                CommentType = comment.CommentType,
                WebCommentID = UniqueID.NewWebID(),
                Path = inReplyToComment == null ? "/" : String.Format("/{0}/", inReplyToComment.InReplyToCommentID),
                SentFromMobile = 1
            };
            result.Save();

            result.ThreadNo = inReplyToComment == null ? result.CommentID : inReplyToComment.ThreadNo;
            result.InReplyToCommentID = inReplyToCommentID == 0 ? result.CommentID : inReplyToCommentID;
            result.Save();

            try
            {
                IncrementCommentCount((CommentType)comment.CommentType, comment.ObjectID);
            }
            catch { }

            return result;
        }
    public AjaxComment PostReply(string type, string WebID, string Body, string ObjWebID)
    {
        Member mem = (Member)HttpContext.Current.Session["Member"];
        AjaxComment ajaxComment = new AjaxComment();

        CommentType = (CommentType)Enum.Parse(typeof(CommentType), type);
        

        Comment inReplyToComment = null;

        if (WebID != string.Empty)
            inReplyToComment = Comment.GetCommentByWebCommentID(WebID);

        Comment comment = new Comment();
        comment.MemberIDFrom = mem.MemberID;
        comment.ObjectID = inReplyToComment.ObjectID;
        comment.DTCreated = DateTime.Now;
        comment.IsDeleted = false;
        comment.WebCommentID = Next2Friends.Misc.UniqueID.NewWebID();
        comment.Text = Body;
        comment.CommentType = (int)CommentType;
        comment.SentFromMobile = 0;

        if (inReplyToComment != null)
        {
            comment.InReplyToCommentID = inReplyToComment.CommentID;
            comment.ThreadNo = inReplyToComment.ThreadNo;
        }

        comment.Save();

        // ++ the comment count for the object if applicable        
        IncrementCommentCount(CommentType, comment.ObjectID);


        if (inReplyToComment == null)
        {
            comment.InReplyToCommentID = comment.CommentID;
            comment.ThreadNo = comment.CommentID;
        }


        if (inReplyToComment.Path != "/")
        {
            comment.Path = inReplyToComment.Path;
        }
        else
        {
            comment.Path = inReplyToComment.Path + inReplyToComment.CommentID + "/";
        }

        comment.Save();

        ajaxComment = AjaxComment.GetAjaxCommentByCommentIDWithJoin(comment.CommentID);
        ajaxComment.WebObjectID = ObjWebID;
        ajaxComment.Type = CommentType.ToString();

        ajaxComment.TotalNumberOfComments = AjaxComment.GetNumberOfCommentByObjectID(comment.ObjectID, (int)CommentType).ToString();

        return ajaxComment;
    }
Exemple #4
0
 private static void UpdateComment(data.Comment commentToUpdate, WebComment comment)
 {
     commentToUpdate.Text = HttpUtility.HtmlEncode(comment.Text);
     commentToUpdate.Save();
 }
    public AjaxComment PostComment(string type, string WebID, string CommentText, int Attempt)
    {
        AjaxComment ajaxComment = new AjaxComment();
        Member member = (Member)HttpContext.Current.Session["Member"];

        CommentType = (CommentType)Enum.Parse(typeof(CommentType), type);
        

        Comment comment = new Comment();

        comment.ObjectID = GetObjectID(CommentType, WebID);
        comment.MemberIDFrom = member.MemberID;
        comment.Text = CommentText;
        comment.DTCreated = DateTime.Now;
        comment.IsDeleted = false;
        comment.CommentType = (int)CommentType;
        comment.WebCommentID = Next2Friends.Misc.UniqueID.NewWebID();
        comment.Path = "/";
        comment.SentFromMobile = 0;
        comment.Save();

        // ++ the comment count for the object if applicable        
        IncrementCommentCount(CommentType, comment.ObjectID);

        comment.ThreadNo = comment.CommentID;
        comment.InReplyToCommentID = comment.CommentID;
        comment.Save();

        ajaxComment = AjaxComment.GetAjaxCommentByCommentIDWithJoin(comment.CommentID);
        ajaxComment.Type = CommentType.ToString();
        ajaxComment.WebObjectID = WebID;
        ajaxComment.TotalNumberOfComments = AjaxComment.GetNumberOfCommentByObjectID(comment.ObjectID,(int)CommentType).ToString();

        return ajaxComment;
    }