static private CreateAndSave ( string contentPath, int creatorId, int lastModifierId, NotificationType type, string who, System.DateTime when ) : void | ||
contentPath | string | |
creatorId | int | |
lastModifierId | int | |
type | NotificationType | |
who | string | |
when | System.DateTime | |
return | void |
internal static void CreateAndSave(string contentPath, int creatorId, int lastModifierId, NotificationType type, string who, DateTime? when)
{
if (type != NotificationType.MovedFrom && type != NotificationType.MovedTo)
if (!IsSubscriptionExist(contentPath))
return;
var @event = new Event
{
ContentPath = contentPath,
NotificationType = type,
Who = who,
CreatorId = creatorId,
LastModifierId = lastModifierId,
};
if (when.HasValue)
@event.When = when.Value;
@event.Save();
}
Event::CreateAndSave ( System.Data.Node node, NotificationType type, string who ) : void | |
Event::CreateAndSave ( string contentPath, int creatorId, int lastModifierId, NotificationType type, string who ) : void |
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); }