示例#1
0
        private void CreateNotifications()
        {
            var notificationTypes = NotificationTypes();

            foreach (var notificationType in notificationTypes)
            {
                var notification       = (Notification)Activator.CreateInstance(notificationType);
                var notificationAccess = new NotificationAccess(notification);
                Notifications.Put(notification);
                NotificationAccesses.Put(notificationAccess);
                var notificationAccessException = new NotificationAccessException(notification);
                NotificationAccessExceptions.Put(notificationAccessException);
                notification.NotificationAccessException = notificationAccessException;
                notification.NotificationAccess          = notificationAccess;
            }
        }
示例#2
0
        private void UpdateNotifications()
        {
            var notificationTypes = NotificationTypes();

            //Todo: In case of deleting a Type create a Script to delete it.

            foreach (var notificationType in notificationTypes)
            {
                var notificationExists = Notifications.ToList().SingleOrDefault(x => x.GetType().IsAssignableFrom(notificationType));
                if (notificationExists == null)
                {
                    var notification       = (Notification)Activator.CreateInstance(notificationType);
                    var notificationAccess = new NotificationAccess(notification);
                    Notifications.Put(notification);
                    NotificationAccesses.Put(notificationAccess);
                }
            }
        }