Exemple #1
0
        private void SyncProductMediaData(ProductMediaDifferential productToSync, Database db)
        {
            var productMedia = ProductMediaRepository.GetMediaForProduct(productToSync.ProductID);

            foreach (var productMediaItem in productMedia)
            {
                var newProductMedia = productMediaItem;
                newProductMedia.ProductID = productToSync.RsoProductID;
                newProductMedia.TypeID    = ProductMediaTypeIDLookup[productMediaItem.TypeID];
                newProductMedia.VendorID  = IntersportContentVendorID;
                newProductMedia.MediaPath = GetNewMediaPath(productMediaItem.MediaPath);

                ProductMediaRepository.AddNewProductMedia(newProductMedia, db);
            }
        }
Exemple #2
0
        private void SyncProductMediaFiles(ProductMediaDifferential productToSync, Database db)
        {
            var productMedias = ProductMediaRepository.GetMediaForProduct(productToSync.ProductID);

            foreach (var productMedia in productMedias)
            {
                var newFileLocation = Path.Combine(MediaLocationBasePath, GetNewMediaPath(productMedia.MediaPath));

                var directoryName = Path.GetDirectoryName(newFileLocation);
                if (!Directory.Exists(directoryName))
                {
                    Directory.CreateDirectory(directoryName);
                }

                if (!File.Exists(newFileLocation))
                {
                    File.Copy(Path.Combine(MediaSourceLocation, productMedia.MediaPath), newFileLocation);
                }
            }
        }