コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="taskId"></param>
        /// <param name="userId"></param>
        /// <param name="groupId"></param>
        /// <param name="type"></param>
        /// <param name="create"></param>
        /// <param name="forceNullUserId"></param>
        public virtual void CreateIdentityLinkComment(string taskId, string userId, string groupId, string type, bool create, bool forceNullUserId)
        {
            if (HistoryEnabled)
            {
                string         authenticatedUserId = Authentication.AuthenticatedUser.Id;
                ICommentEntity comment             = CommentEntityManager.Create();
                comment.UserId = authenticatedUserId;
                comment.Type   = CommentEntityFields.TYPE_EVENT;
                comment.Time   = Clock.CurrentTime;
                comment.TaskId = taskId;
                if (userId is object || forceNullUserId)
                {
                    if (create)
                    {
                        comment.Action = EventFields.ACTION_ADD_USER_LINK;
                    }
                    else
                    {
                        comment.Action = EventFields.ACTION_DELETE_USER_LINK;
                    }
                    comment.MessageParts = new string[] { userId, type };
                }
                else
                {
                    if (create)
                    {
                        comment.Action = EventFields.ACTION_ADD_GROUP_LINK;
                    }
                    else
                    {
                        comment.Action = EventFields.ACTION_DELETE_GROUP_LINK;
                    }
                    comment.MessageParts = new string[] { groupId, type };
                }

                CommentEntityManager.Insert(comment);
            }
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="taskId"></param>
 /// <param name="processInstanceId"></param>
 /// <param name="attachmentName"></param>
 /// <param name="create"></param>
 public virtual void CreateAttachmentComment(string taskId, string processInstanceId, string attachmentName, bool create)
 {
     if (HistoryEnabled)
     {
         string         userId  = Authentication.AuthenticatedUser.Id;
         ICommentEntity comment = CommentEntityManager.Create();
         comment.UserId            = userId;
         comment.Type              = CommentEntityFields.TYPE_EVENT;
         comment.Time              = Clock.CurrentTime;
         comment.TaskId            = taskId;
         comment.ProcessInstanceId = processInstanceId;
         if (create)
         {
             comment.Action = EventFields.ACTION_ADD_ATTACHMENT;
         }
         else
         {
             comment.Action = EventFields.ACTION_DELETE_ATTACHMENT;
         }
         comment.MessageParts = new string[] { attachmentName };
         CommentEntityManager.Insert(comment);
     }
 }