コード例 #1
0
        /// <summary>
        /// 发表对职业路线的评论
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="pathId">职业路线ID</param>
        /// <param name="content">评论内容</param>
        /// <returns></returns>
        public RetJsonModel PublishComment(string userId, string pathId, string content, int pathType)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = timestamp;

                db.Ado.BeginTran();
                BUS_CAREERPATH_COMMENT commentModel = new BUS_CAREERPATH_COMMENT();
                commentModel.ID = Guid.NewGuid().ToString();
                commentModel.DATETIME_CREATED = now;
                commentModel.STATE            = "A";
                commentModel.TIMESTAMP_INT    = timestamp;
                commentModel.PATH_ID          = pathId;
                commentModel.CONTENT          = content;
                commentModel.FROM_UID         = userId;
                commentModel.PATH_TYPE        = pathType;
                db.Insertable(commentModel).ExecuteCommand();

                //保存通知
                MessageClass MC = new MessageClass();
                MC.SaveMsg(db, userId, pathId, 1, 1, content);

                db.Ado.CommitTran();

                jsonModel.status = 1;
                jsonModel.msg    = "评论成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }
コード例 #2
0
        /// <summary>
        /// 发表对评论的回复或用户间的互动
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="commentId">评论表ID</param>
        /// <param name="replyId">评论表ID</param>
        /// <param name="replyType">评论表类型(COMMENT:评论;REPLY:回复)</param>
        /// <param name="content">评论内容</param>
        /// <param name="toUid">被评论人ID</param>
        /// <returns></returns>
        public RetJsonModel PublishReply(string userId, string commentId, string replyId, string content, string toUid)
        {
            var db = DBContext.GetInstance;

            try
            {
                DateTime now       = db.GetDate();
                int      timestamp = FunctionHelper.GetTimestamp();

                RetJsonModel jsonModel = new RetJsonModel();
                jsonModel.time = timestamp;

                db.Ado.BeginTran();
                BUS_COMMENT_REPLY replyModel = new BUS_COMMENT_REPLY();
                replyModel.ID = Guid.NewGuid().ToString();
                replyModel.DATETIME_CREATED = now;
                replyModel.STATE            = "A";
                replyModel.TIMESTAMP_INT    = timestamp;
                replyModel.COMMENT_ID       = commentId;
                replyModel.REPLY_ID         = replyId;
                replyModel.CONTENT          = content;
                replyModel.FROM_UID         = userId;
                replyModel.TO_UID           = toUid;
                db.Insertable(replyModel).ExecuteCommand();

                //保存通知
                MessageClass MC = new MessageClass();
                MC.SaveMsg(db, userId, commentId, 2, 4, content);

                jsonModel.status = 1;
                jsonModel.msg    = "回复成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                db.Ado.RollbackTran();
                throw ex;
            }
        }