コード例 #1
0
        public IHttpActionResult GetDynamicContentPublicationById(string id)
        {
            var retVal = _dynamicContentService.GetPublicationById(id);

            if (retVal != null)
            {
                return(Ok(retVal.ToWebModel(_marketingExtensionManager.DynamicContentExpressionTree)));
            }
            return(NotFound());
        }
コード例 #2
0
        private BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback)
        {
            var result       = new BackupObject();
            var progressInfo = new ExportImportProgressInfo {
                Description = "Search promotions..."
            };

            progressCallback(progressInfo);
            var allPromotions = _marketingSearchService.SearchResources(new MarketingSearchCriteria
            {
                Count         = int.MaxValue,
                ResponseGroup = SearchResponseGroup.WithPromotions
            }).Promotions;

            progressInfo.Description = String.Format("{0} promotions loading...", allPromotions.Count());
            progressCallback(progressInfo);
            result.Promotions = allPromotions.Select(x => _promotionService.GetPromotionById(x.Id)).ToList();

            progressInfo.Description = "Search dynamic content objects...";
            progressCallback(progressInfo);

            var searchResult           = SearchInFolder(null);
            var allFolderSearchResults = searchResult != null?searchResult.Traverse(ChildrenForFolder).ToArray() : null;


            if (allFolderSearchResults != null)
            {
                progressInfo.Description = String.Format("Loading folders...");
                progressCallback(progressInfo);
                result.ContentFolders = allFolderSearchResults.SelectMany(x => x.ContentFolders).ToList();

                progressInfo.Description = String.Format("Loading places...");
                progressCallback(progressInfo);
                result.ContentPlaces = allFolderSearchResults.SelectMany(x => x.ContentPlaces)
                                       .Select(x => _dynamicContentService.GetPlaceById(x.Id))
                                       .ToList();

                progressInfo.Description = String.Format("Loading contents...");
                progressCallback(progressInfo);
                result.ContentItems = allFolderSearchResults.SelectMany(x => x.ContentItems)
                                      .Select(x => _dynamicContentService.GetContentItemById(x.Id))
                                      .ToList();

                progressInfo.Description = String.Format("Loading publications...");
                progressCallback(progressInfo);
                result.ContentPublications = allFolderSearchResults.SelectMany(x => x.ContentPublications)
                                             .Select(x => _dynamicContentService.GetPublicationById(x.Id))
                                             .ToList();
            }
            return(result);
        }
コード例 #3
0
        private void SearchContentPublications(coreModel.MarketingSearchCriteria criteria, coreModel.MarketingSearchResult result)
        {
            using (var repository = _repositoryFactory())
            {
                var query = repository.PublishingGroups;
                result.TotalCount += query.Count();

                var ids = query.OrderBy(x => x.Id)
                          .Select(x => x.Id)
                          .Skip(criteria.Start)
                          .Take(criteria.Count).ToArray();
                result.ContentPublications = ids.Select(x => _dynamicContentService.GetPublicationById(x)).ToList();
            }
        }
コード例 #4
0
        private BackupObject GetBackupObject()
        {
            var responce = _marketingSearchService.SearchResources(new MarketingSearchCriteria {
                Count = int.MaxValue, ResponseGroup = SearchResponseGroup.Full
            });

            var backupObject = new BackupObject
            {
                Promotions          = responce.Promotions.Select(x => _promotionService.GetPromotionById(x.Id)).ToArray(),
                Coupons             = responce.Coupons,
                ContentPlaces       = responce.ContentPlaces,
                ContentItems        = responce.ContentItems,
                ContentPublications = responce.ContentPublications.Select(x => _dynamicContentService.GetPublicationById(x.Id)).ToArray(),
                ContentFolders      = responce.ContentFolders
            };

            ContentComplete(responce.ContentFolders.Select(x => x.Id).ToArray(), backupObject);
            return(backupObject);
        }