Beispiel #1
0
        private long getParentId(IComment x)
        {
            if (x.ParentId <= 0)
            {
                return(0);
            }

            // 旧版数据
            if (x.ParentId == x.RootId)
            {
                return(0);
            }

            CommentLevel level = new CommentLevel {
                Count = 1
            };
            long parentId = getOldParentId(x.ParentId, level);

            OpenCommentTrans trans = OpenCommentTrans.find("CommentId=:cid and CommentType=:ctype")
                                     .set("cid", parentId)
                                     .set("ctype", x.GetType().FullName)
                                     .first();

            if (trans == null)
            {
                return(0);
            }

            if (trans.OpenCommentId <= 0)
            {
                return(0);
            }

            return(trans.OpenCommentId);
        }
Beispiel #2
0
        private int getParentId(TComment obj)
        {
            IComment x = obj as IComment;

            if (x.ParentId <= 0)
            {
                return(0);
            }

            int parentId = getOldParentId(x.ParentId);

            OpenCommentTrans trans = OpenCommentTrans.find("CommentId=:cid and CommentType=:ctype")
                                     .set("cid", parentId)
                                     .set("ctype", x.GetType().FullName)
                                     .first();

            if (trans == null)
            {
                return(0);
            }

            if (trans.OpenCommentId <= 0)
            {
                return(0);
            }

            return(trans.OpenCommentId);
        }
Beispiel #3
0
        private void logTransInfo(IComment x, OpenComment comment)
        {
            OpenCommentTrans trans = new OpenCommentTrans();

            trans.CommentId     = x.Id;
            trans.CommentType   = x.GetType().FullName;
            trans.OpenCommentId = comment.Id;

            trans.insert();
        }
Beispiel #4
0
        private OpenComment hasImport(IComment x)
        {
            OpenCommentTrans trans = OpenCommentTrans.find("CommentId=:cid and CommentType=:ctype")
                                     .set("cid", x.Id)
                                     .set("ctype", commentType.FullName)
                                     .first();

            if (trans == null)
            {
                return(null);
            }

            return(OpenComment.findById(trans.OpenCommentId));
        }
Beispiel #5
0
 private void deleteTransLog(OpenComment oc)
 {
     OpenCommentTrans.deleteBatch("OpenCommentId=" + oc.Id);
 }