Beispiel #1
0
        private void TryAddWorkflowLog(ContentItem contentItem, WorkflowState state, WorkflowLogType logType, int userId, string userComment)
        {
            var workflow    = _workflowManager.GetWorkflow(contentItem);
            var logTypeText = GetWorkflowActionComment(logType);
            var logComment  = ReplaceNotificationTokens(logTypeText, workflow, contentItem, state, userId, userComment);

            _workflowLogger.AddWorkflowLog(contentItem.ContentItemId, workflow.WorkflowID, logType, logComment, userId);
        }
Beispiel #2
0
 private void AddWorkflowLog(ContentItem contentItem, WorkflowState state, WorkflowLogType logType, int userId, string userComment = null)
 {
     try
     {
         TryAddWorkflowLog(contentItem, state, logType, userId, userComment);
     }
     catch (Exception ex)
     {
         Services.Exceptions.Exceptions.LogException(ex);
     }
 }
        private void AddWorkflowLog(int contentItemId, int workflowId, WorkflowLogType type, string action, string comment, int userId)
        {
            var workflowLog = new WorkflowLog
            {
                ContentItemID = contentItemId,
                WorkflowID    = workflowId,
                Type          = (int)type,
                Action        = action,
                Comment       = comment,
                User          = userId,
                Date          = DateTime.UtcNow
            };

            _workflowLogRepository.AddWorkflowLog(workflowLog);
        }
Beispiel #4
0
        private UserInfo GetUserByWorkflowLogType(ContentItem contentItem, WorkflowLogType type)
        {
            var workflow = _workflowManager.GetWorkflow(contentItem);

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

            var logs = _workflowLogRepository.GetWorkflowLogs(contentItem.ContentItemId, workflow.WorkflowID);

            var logDraftCompleted = logs
                                    .OrderByDescending(l => l.Date)
                                    .FirstOrDefault(l => l.Type == (int)type);

            if (logDraftCompleted != null && logDraftCompleted.User != Null.NullInteger)
            {
                return(_userController.GetUserById(workflow.PortalID, logDraftCompleted.User));
            }
            return(null);
        }
Beispiel #5
0
        private static string GetWorkflowActionComment(WorkflowLogType logType)
        {
            var logName = Enum.GetName(typeof(WorkflowLogType), logType);

            return(Localization.GetString(logName + ".Comment"));
        }
Beispiel #6
0
        private void AddWorkflowLog(ContentItem contentItem, WorkflowLogType logType, int userId, string userComment = null)
        {
            var state = _workflowStateRepository.GetWorkflowStateByID(contentItem.StateID);

            AddWorkflowLog(contentItem, state, logType, userId, userComment);
        }
 public void AddWorkflowLog(int contentItemId, int workflowId, WorkflowLogType type, string comment, int userId)
 {
     AddWorkflowLog(contentItemId, workflowId, type, GetWorkflowActionText(type), comment, userId);
 }