Exemple #1
0
        private CollectionListResponse GetAllCollections()
        {
            CollectionListResponse allCollections = new CollectionListResponse();

            allCollections.Items = new List <CollectionResponse>();

            CollectionListResponse collections = SearchCollections();

            int  offset           = 0;
            int  page             = 0;
            bool isDoneTraversing = false;

            while (!isDoneTraversing)
            {
                allCollections.Items.AddRange(collections.Items);

                if (collections.Items.Count == DEFAULT_COUNT)
                {
                    offset     += DEFAULT_COUNT;
                    collections = SearchCollections(offset);
                    page++;
                }
                else
                {
                    isDoneTraversing = true;
                }
            }

            return(allCollections);
        }
Exemple #2
0
        private CollectionListResponse SearchCollections(int offset)
        {
            CollectionListResponse collections = _client.Collections.SearchCollections(new CollectionSearchRequest
            {
                Count  = DEFAULT_COUNT,
                Offset = offset
            });

            return(collections);
        }
Exemple #3
0
        private List <CollectionItemResponse> GetAllContentForCollections(CollectionListResponse collections)
        {
            List <CollectionItemResponse> contentList = new List <CollectionItemResponse>();

            foreach (CollectionResponse collection in collections.Items)
            {
                List <CollectionItemResponse> collectionContent = GetAllContentForCollection(collection.Slug);
                contentList.AddRange(collectionContent);
            }

            return(contentList);
        }
Exemple #4
0
        //
        // GET: /License/DisplayCollections
        public ActionResult DisplayCollections()
        {
            CollectionListResponse collections = _client.Collections.SearchCollections(new CollectionSearchRequest
            {
                Count = DEFAULT_COUNT
            });

            //Trim the results if this is a public demo.
            if (IsPublicDemo())
            {
                List <CollectionResponse> trimmedList = new List <CollectionResponse>();
                trimmedList.AddRange(collections.Items.Take(TRIM_COUNT));

                collections.Items = trimmedList;
            }

            return(View(collections));
        }
Exemple #5
0
        private List <ContentReferenceModel> GetContentForDownload()
        {
            //Get all items from buckets
            ContentBucketList allBuckets         = GetAllBuckets();
            ContentList       contentFromBuckets = GetAllContentForBuckets(allBuckets);

            //Get all items from collection
            CollectionListResponse        collections             = GetAllCollections();
            List <CollectionItemResponse> collectionItemResponses = GetAllContentForCollections(collections);

            //Convert and combine everything into single model.
            List <ContentReferenceModel> contentToDownload = new List <ContentReferenceModel>();

            contentToDownload.AddRange(ConvertToContentModel(contentFromBuckets));
            contentToDownload.AddRange(ConvertToContentModel(collectionItemResponses));

            //Remove all duplicates.
            contentToDownload = RemoveDuplicates(contentToDownload);

            return(contentToDownload);
        }
Exemple #6
0
        public async Task <CollectionListResponse> getcollections(CollectionListRequest collectionListRequest)
        {
            try
            {
                var crmRequestHelper = new CrmRequestHelper();
                var response         = new CollectionListResponse()
                {
                };
                XDocument fetchXdoc = await _deliveryRepository.GetOrderPayListFetchXml(collectionListRequest);

                var entities = await crmRequestHelper.ExecuteAsync(_crmService, orderpayEntityName, fetchXdoc);

                response.Collections   = entities.Results;
                response.ALLTotalCount = entities.Count;
                response.PageSize      = collectionListRequest.PageSize;
                response.CurrentPage   = collectionListRequest.PageIndex;
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }