public void ProcessExhibits(IProgressListener listener, ITransactionDataAccess dataAccess, Dictionary <MediaDto, string> mediaToFilePath)
        {
            var fetchedMedia = mediaDataFetcher.CombineMediasAndFiles(dataAccess, mediaToFilePath);

            ProcessUpdatedExhibits(listener, fetchedMedia, dataAccess);
            ProcessNewExhibits(listener, fetchedMedia, dataAccess);
        }
Exemple #2
0
        private void ProcessPages(string exhibitId, CancellationToken token, ITransactionDataAccess dataAccess,
                                  Dictionary <MediaDto, string> mediaToFilePath)
        {
            var fetchedMedia = mediaDataFetcher.CombineMediasAndFiles(dataAccess, mediaToFilePath);

            if (token.IsCancellationRequested)
            {
                return;
            }

            var exhibit = dataAccess.Exhibits().GetExhibit(exhibitId);

            foreach (var pageDto in pageItems)
            {
                var dbPage = PageConverter.Convert(pageDto);

                AddContentToPage(dbPage, pageDto, fetchedMedia);
                // Add Page with content to the exhibit
                exhibit.Pages.Add(dbPage);
            }

            // Rearrange additional information pages
            var pagesToBeRemoved = new List <Page>();

            foreach (var pageDto in pageItems)
            {
                if (pageDto.AdditionalInformationPages.Count > 0)
                {
                    foreach (var existingPageWithInfo in exhibit.Pages)
                    {
                        if (pageDto.Id == existingPageWithInfo.IdForRestApi)
                        {
                            foreach (var pageId in pageDto.AdditionalInformationPages)
                            {
                                foreach (var pageToBeAdded in exhibit.Pages)
                                {
                                    if (pageToBeAdded.IdForRestApi == pageId)
                                    {
                                        existingPageWithInfo.AdditionalInformationPages.Add(pageToBeAdded);
                                        pagesToBeRemoved.Add(pageToBeAdded);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            foreach (var pageToBeRemoved in pagesToBeRemoved)
            {
                exhibit.Pages.Remove(pageToBeRemoved);
            }

            exhibit.DetailsDataLoaded = true;
        }
Exemple #3
0
        private void ProcessRoute(CancellationToken token, ITransactionDataAccess dataAccess, Dictionary <MediaDto, string> mediaToFilePath)
        {
            var fetchedMedia = mediaDataFetcher.CombineMediasAndFiles(dataAccess, mediaToFilePath);

            if (token.IsCancellationRequested)
            {
                return;
            }

            AddAudioToRoute(route, routeDto.Audio, fetchedMedia);
        }