Наследование: INotifyPropertyChanging, INotifyPropertyChanged
Пример #1
0
        //-- 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();
        }
Пример #2
0
        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();
        }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }
Пример #5
0
 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);
 }
Пример #6
0
 partial void DeleteEvent(Event instance);
Пример #7
0
 partial void UpdateEvent(Event instance);
Пример #8
0
 partial void InsertEvent(Event instance);