Esempio n. 1
0
        public void Handle(BookFileDeletedEvent message)
        {
            var deleteMessage = new BookFileDeleteMessage();

            var book = new List <Book> {
                message.BookFile.Edition.Value.Book
            };

            deleteMessage.Message  = GetMessage(message.BookFile.Author, book, message.BookFile.Quality);
            deleteMessage.BookFile = message.BookFile;
            deleteMessage.Book     = message.BookFile.Edition.Value.Book;
            deleteMessage.Reason   = message.Reason;

            foreach (var notification in _notificationFactory.OnBookFileDeleteEnabled())
            {
                try
                {
                    if (message.Reason != MediaFiles.DeleteMediaFileReason.Upgrade || ((NotificationDefinition)notification.Definition).OnBookFileDeleteForUpgrade)
                    {
                        if (ShouldHandleAuthor(notification.Definition, message.BookFile.Author))
                        {
                            notification.OnBookFileDelete(deleteMessage);
                        }
                    }
                }
                catch (Exception ex)
                {
                    _logger.Warn(ex, "Unable to send OnBookFileDelete notification to: " + notification.Definition.Name);
                }
            }
        }
Esempio n. 2
0
 public virtual void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
 {
 }