//-- caller: NotificationObserver public static void CreateAndSave(Node node, NotificationType type, string who) { if (type != NotificationType.MovedFrom && type != NotificationType.MovedTo) if (!IsSubscriptionExist(node.Path)) return; var @event = new Event { ContentPath = node.Path, NotificationType = type, Who = who, CreatorId = node.CreatedById, LastModifierId = node.NodeModifiedById }; @event.Save(); }
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(); }
internal void AddRelatedEvent(Event @event) { var toRemove = RelatedEvents.Where(x => x.NotificationType == @event.NotificationType && x.ContentPath == @event.ContentPath && x.When < @event.When).FirstOrDefault(); if (toRemove != null) _relatedEvents.Remove(toRemove); _relatedEvents.Add(@event); }
private static string ReplaceParameters(string template, string sitePath, string siteUrl, Event @event, CultureInfo cultureInfo) { return template .Replace("{ContentPath}", @event.ContentPath) .Replace("{ContentUrl}", String.Concat("http://", GetContentUrl(sitePath, siteUrl, @event.ContentPath))) //.Replace("{NotificationType}", @event.NotificationType.ToString()) .Replace("{When}", @event.When.ToString(cultureInfo)) .Replace("{Who}", @event.Who); }
private static bool HasPermission(Subscription subscription, Event @event) { if (@event.NotificationType == NotificationType.MinorVersionModified) return SecurityHandler.HasPermission(subscription.User, @event.ContentPath, @event.CreatorId, @event.LastModifierId, PermissionType.OpenMinor); else return SecurityHandler.HasPermission(subscription.User, @event.ContentPath, @event.CreatorId, @event.LastModifierId, PermissionType.Open); }
partial void DeleteEvent(Event instance);
partial void UpdateEvent(Event instance);
partial void InsertEvent(Event instance);