コード例 #1
0
        public void CheckReferenceConverter()
        {
            // variationController has demo code for "Loading examples"
            ContentReference theRef = _referenceConverter.GetContentLink("Shirts_1");
            int theInt = _referenceConverter.GetObjectId(theRef);

            CatalogContentType theType = _referenceConverter.GetContentType(theRef);

            ContentReference theSameRef = _referenceConverter.GetContentLink
                                              (theInt, CatalogContentType.CatalogNode, 0);

            string theCode = _referenceConverter.GetCode(theSameRef);

            ContentReference catalogRoot = _referenceConverter.GetRootLink();

            List <string> codes = new List <string>
            {
                "Shirts_1",
                "Men_1"
            };

            IDictionary <string, ContentReference> theDict;

            theDict = _referenceConverter.GetContentLinks(codes);
        }
        public IEnumerable <ResolvedContentType> ResolveContentTypesFromCodes(IEnumerable <string> codes,
                                                                              CatalogContentType catalogContentType)
        {
            var references = _referenceConverter.GetContentLinks(codes, catalogContentType);

            return(ResolveContentTypes(references.Values));
        }
コード例 #3
0
        protected T GetContent <T>(string code, CatalogContentType contentType) where T : IContentData
        {
            var contentLink = _referenceConverter.GetContentLink(code, contentType);

            if (ContentReference.IsNullOrEmpty(contentLink) == false)
            {
                var content = _contentRepository.Get <T>(contentLink);
                return(content);
            }
            return(default(T));
        }
コード例 #4
0
        private void OnDeletedContent(object sender, DeleteContentEventArgs e)
        {
            Logger.Debug("OnDeletedContent raised.");

            ContentReference deletedContentLink = e.ContentLink;

            if (ContentReference.IsNullOrEmpty(deletedContentLink) ||
                deletedContentLink.ProviderName != ReferenceConverter.CatalogProviderKey)
            {
                Logger.Debug("Deleted content is not catalog content.");
                return;
            }

            CatalogContentType catalogContentType = _referenceConverter.GetContentType(deletedContentLink);

            if (catalogContentType != CatalogContentType.CatalogNode)
            {
                Logger.Debug("Deleted content is not a catalog node.");
                return;
            }

            // Force a full category structure re-export. This has to be done AFTER the category has been deleted.
            _categoryExportService.StartFullCategoryExport();
        }
コード例 #5
0
 private ContentReference GetContentReference(int contentId, CatalogContentType catalogContentType)
 {
     return(_referenceConverterMock.Object.GetContentLink(contentId, catalogContentType, 0));
 }
コード例 #6
0
 private ContentReference GetContentReference(int contentId, CatalogContentType catalogContentType)
 {
     return _referenceConverterMock.Object.GetContentLink(contentId, catalogContentType, 0);
 }
コード例 #7
0
 private IEnumerable <KeyValuePair <ContentReference, ContentType> > ResolveContentTypes(DataTable table, CatalogContentType contentType)
 {
     foreach (DataRow row in table.Rows)
     {
         var id            = (int)row["Id"];
         var metaClassName = row["MetaClassName"].ToString();
         var contentLink   = _referenceConverter.GetContentLink(id, contentType, 0);
         if (_metaClassContentTypeModelMap.TryGetValue(metaClassName, out var contentTypeModel))
         {
             yield return(new KeyValuePair <ContentReference, ContentType>(contentLink, contentTypeModel.ExistingContentType));
         }
     }
 }