コード例 #1
0
        /// <summary>
        /// Runs when the activity is run by the workflow.
        /// </summary>
        /// <param name="context">The run state.</param>
        /// <param name="inputs">The inputs.</param>
        void IRunNowActivity.OnRunNow(IRunState context, ActivityInputs inputs)
        {
            var text           = GetArgumentValue <string>(inputs, "inLogActivityMessage");
            var refencedObject = GetArgumentEntity <UserResource>(inputs, "inLogActivityObject");

            IEntity logEntry;

            if (refencedObject != null)
            {
                logEntry = new LogActivityResourceLogEntry
                {
                    ObjectReferencedInLog = refencedObject,
                    ReferencedObjectName  = refencedObject.Name
                };
            }
            else
            {
                logEntry = new LogActivityLogEntry();
            }

            logEntry.SetField(WorkflowRunLogEntry.Name_Field, ActivityInstance.Name);
            logEntry.SetField(WorkflowRunLogEntry.Description_Field, text);

            context.Log(logEntry);

            // Provide some context information to the log message
            EventLog.Application.WriteInformation(string.Format("Log | {1} | Message: {2}", DateTime.UtcNow.Ticks, context.GetSafeWorkflowDescription(), text));
        }
コード例 #2
0
 void RecordInfoToUserLog(IRunState context, string message)
 {
     context.Log(new WorkflowRunLogEntry
     {
         LogEntrySeverity_Enum = LogSeverityEnum_Enumeration.InformationSeverity,
         Name        = "Email send information",
         Description = message
     });
 }
コード例 #3
0
 void RecordErrorToUserLog(IRunState context, Exception ex)
 {
     context.Log(new WorkflowRunLogEntry
     {
         LogEntrySeverity_Enum = LogSeverityEnum_Enumeration.WarningSeverity,
         Name        = "Email send failed",
         Description = ex.Message
     });
 }
コード例 #4
0
        void CreateLogEntry(IRunState context, DisplayFormUserTask userTask)
        {
            var actingPersonName = userTask.AssignedToUser != null ? userTask.AssignedToUser.Name : null;

            // Create the log entry
            context.Log(new WorkflowUserActionLogEntry
            {
                Name                        = ActivityInstance.Name,
                LogEventTime                = DateTime.UtcNow,
                UserActionBeingLogged       = userTask,
                WuleDueDate                 = userTask.UserTaskDueOn,
                ActingPersonReferencedInLog = userTask.AssignedToUser,
                ActingPersonName            = actingPersonName,
                ObjectReferencedInLog       = userTask.RecordToPresent,
                Description                 = string.Format("Assigned to: {0}, Due: {1}", actingPersonName ?? "", userTask.UserTaskDueOn)
            });
        }