Exemplo n.º 1
0
        /// <summary>
        /// Updates an audit event after the method is invoked.
        /// </summary>
        protected virtual void UpdateAuditEvent(
            ISystemContext context,
            MethodState causeMethod,
            uint causeId,
            AuditUpdateStateEventState e,
            ServiceResult result)
        {
            TranslationInfo info = new TranslationInfo(
                "StateTransition",
                "en-US",
                "The {1} method called was on the {0} state machine.",
                this.GetDisplayPath(3, '.'),
                causeMethod.DisplayName);

            e.Initialize(
                context,
                this,
                EventSeverity.Medium,
                new LocalizedText(info),
                ServiceResult.IsGood(result),
                DateTime.UtcNow);

            e.MethodId       = new PropertyState <NodeId>(e);
            e.MethodId.Value = causeMethod.NodeId;

            e.SetChildValue(context, BrowseNames.OldStateId, LastState, false);
            e.SetChildValue(context, BrowseNames.NewStateId, CurrentState, false);
        }
        /// <summary>
        /// Updates an audit event after the method is invoked.
        /// </summary>
        protected virtual void UpdateAuditEvent(
            ISystemContext context,
            MethodState causeMethod,
            IList <object> inputArguments,
            uint causeId,
            AuditUpdateStateEventState e,
            ServiceResult result)
        {
            TranslationInfo info = new TranslationInfo(
                "StateTransition",
                "en-US",
                "The {1} method called was on the {0} state machine.",
                this.GetDisplayPath(3, '.'),
                causeMethod.DisplayName);

            e.Initialize(
                context,
                this,
                EventSeverity.Medium,
                new LocalizedText(info),
                ServiceResult.IsGood(result),
                DateTime.UtcNow);

            e.SetChildValue(context, BrowseNames.SourceNode, NodeId, false);
            e.SetChildValue(context, BrowseNames.SourceName, $"Method/{causeMethod.BrowseName.Name}", false);
            e.SetChildValue(context, BrowseNames.LocalTime, Utils.GetTimeZoneInfo(), false);

            // AuditUpdateMethodStateEventType properties
            e.SetChildValue(context, BrowseNames.MethodId, causeMethod.NodeId, false);
            e.SetChildValue(context, BrowseNames.InputArguments, inputArguments, false);

            // AuditUpdateStateEventType properties
            e.SetChildValue(context, BrowseNames.OldStateId, LastState, false);
            e.SetChildValue(context, BrowseNames.NewStateId, CurrentState, false);
        }
        /// <summary>
        /// Updates an audit event after the method is invoked.
        /// </summary>
        protected virtual void UpdateAuditEvent(
            ISystemContext context,
            MethodState causeMethod,
            uint causeId,
            AuditUpdateStateEventState e,
            ServiceResult result)
        {            
            TranslationInfo info = new TranslationInfo(
                "StateTransition",
                "en-US",
                "The {1} method called was on the {0} state machine.",
                this.GetDisplayPath(3, '.'),
                causeMethod.DisplayName);

            e.Initialize(
                context,
                this,
                EventSeverity.Medium,
                new LocalizedText(info),
                ServiceResult.IsGood(result),
                DateTime.UtcNow);
            
            e.MethodId = new PropertyState<NodeId>(e);
            e.MethodId.Value = causeMethod.NodeId;

            e.SetChildValue(context, BrowseNames.OldStateId, LastState, false);
            e.SetChildValue(context, BrowseNames.NewStateId, CurrentState, false);
        }