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); }
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); }