예제 #1
0
        public void Process(ProductRepository <Album> productRepository)
        {
            var albumRepository = productRepository as AlbumRepository;

            if (albumRepository == null)
            {
                throw new InvalidCastException("ProductRepository cannot be cast to AlbumRepository");
            }

            var nodes = new List <XElement>();

            foreach (var review in albumRepository.ExplodedReviews)
            {
                try
                {
                    nodes.Add(_xmlCreator.GetXmlForReport(review.RecordId));
                }
                catch (Exception ex)
                {
                    Logging.Instance.LogError(string.Format("Une erreur est survenue lors de la génération du fichier complet des reviews (review {0}) : {1}", review.RecordId, ex.Message), ErrorLevel.Error);
                    continue;
                }
            }

            var doc = _xmlCreator.CreateReport(nodes);

            _xmlCreator.Publish(doc, "AllReviews");
        }
        public void Process(ProductRepository <Album> productRepository)
        {
            var albumRepository = productRepository as AlbumRepository;
            var outputDir       = Constants.DeezerOperationsOutputDirectoryPath;

            if (albumRepository == null)
            {
                throw new InvalidCastException("ProductRepository cannot be cast to AlbumRepository");
            }

            var nodes = new List <XElement>();

            foreach (var review in albumRepository.LatestExplodedReviews)
            {
                nodes.Add(_xmlCreator.GetXmlForReport(review.RecordId));
            }

            var doc = _xmlCreator.CreateReport(nodes);

            _xmlCreator.Publish(doc, "LastReviews", outputDir);
        }