CreateAndSave() public static method

public static CreateAndSave ( System.Data.Node node, NotificationType type, string who ) : void
node System.Data.Node
type NotificationType
who string
return void
コード例 #1
0
        protected override void OnNodeMoved(object sender, NodeOperationEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var currentUser    = User.Current;
            var srcnode        = e.SourceNode;
            var creatorId      = srcnode.CreatedById;
            var lastModifierId = currentUser.Id;
            var who            = GetUserName(currentUser);

            if (IsInTrash(e.OriginalSourcePath))
            {
                Event.CreateAndSave(srcnode.Path, creatorId, lastModifierId, NotificationType.Restored, who);
                return;
            }
            if (IsInTrash(srcnode.Path))
            {
                Event.CreateAndSave(e.OriginalSourcePath, creatorId, lastModifierId, NotificationType.Deleted, who);
                return;
            }
            Event.CreateAndSave(e.OriginalSourcePath, creatorId, lastModifierId, NotificationType.MovedTo, who);
            Event.CreateAndSave(srcnode.Path, creatorId, lastModifierId, NotificationType.MovedFrom, who);
        }
コード例 #2
0
        protected override void OnNodeModified(object sender, NodeEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var node = e.SourceNode;

            if (node != null && DocumentPreviewProvider.Current.IsPreviewOrThumbnailImage(NodeHead.Get(node.Id)))
            {
                return;
            }

            var who  = GetLastModifierUserName(node);
            var type = node.Version.Status == VersionStatus.Approved ? NotificationType.MajorVersionModified : NotificationType.MinorVersionModified;

            if (node.Path == e.OriginalSourcePath)
            {
                Event.CreateAndSave(node, type, who);
                return;
            }
            var currentUser    = User.Current;
            var creatorId      = node.CreatedById;
            var lastModifierId = currentUser.Id;

            Event.CreateAndSave(e.OriginalSourcePath, creatorId, lastModifierId, NotificationType.RenamedTo, who);
            Event.CreateAndSave(node.Path, creatorId, lastModifierId, NotificationType.RenamedFrom, who);
        }
コード例 #3
0
        protected override void OnNodeDeletedPhysically(object sender, NodeEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var currentUser = User.Current;
            var who         = GetUserName(currentUser);
            var node        = e.SourceNode;

            Event.CreateAndSave(node, NotificationType.Deleted, who);
        }
コード例 #4
0
        protected override void OnNodeCreated(object sender, NodeEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var node = e.SourceNode;
            var who  = GetLastModifierUserName(node);
            var type = node.CopyInProgress ? NotificationType.CopiedFrom : NotificationType.Created;

            Event.CreateAndSave(node, type, who);
        }
コード例 #5
0
        protected override void OnNodeCreated(object sender, NodeEventArgs e)
        {
            if (!Configuration.Enabled)
            {
                return;
            }

            var node = e.SourceNode;

            if (node != null && DocumentPreviewProvider.Current.IsPreviewOrThumbnailImage(NodeHead.Get(node.Id)))
            {
                return;
            }

            var who  = GetLastModifierUserName(node);
            var type = node.CopyInProgress ? NotificationType.CopiedFrom : NotificationType.Created;

            Event.CreateAndSave(node, type, who);
        }