Exemple #1
0
        public static ItemImportMap BuildMapInfo(ID mapId)
        {
            var database         = Sitecore.Configuration.Factory.GetDatabase("master");
            var mapItem          = database.GetItem(mapId);
            var inputColumnsItem =
                mapItem.FirstChildInheritingFrom(InputColumnCollectionItem.TemplateId);

            var mapInfo = new ItemImportMap
            {
                InputFields = inputColumnsItem.Children.Select(c => new InputField {
                    Name = c.Name
                }).ToList(),
                OutputMaps = mapItem.Children
                             .Where(c => c.InheritsFrom(OutputMapTemplateItem.TemplateId))
                             .Select(om => CreateOutputMap(om, null))
                             .ToList()
            };

            return(mapInfo);
        }
Exemple #2
0
        public static ItemImportMap BuildMapInfo(MapItem mapItem, ID templateID, ContentType contentType)
        {
            var mapInfo = new ItemImportMap
            {
                InputFields = mapItem.InputFields.Select(fieldName => new InputField {
                    Name = fieldName
                }).ToList(),
                OutputMaps = new List <OutputMap>()
            };

            if (contentType == ContentType.Store)
            {
                mapInfo.OutputMaps = SetStoreMap(mapItem, templateID);
            }
            else if (contentType == ContentType.Banner)
            {
                mapInfo.OutputMaps = SetBannerMap(mapItem, templateID);
            }
            else if (contentType == ContentType.Event)
            {
                mapInfo.OutputMaps = SetEventMap(mapItem, templateID);
            }
            else if (contentType == ContentType.Article)
            {
                if (templateID == FrasersContent.Templates.SpecialEvent.ID)
                {
                    mapInfo.OutputMaps = SetSpecialEventMap(mapItem, templateID);
                }
                else
                {
                    mapInfo.OutputMaps = SetArticleMap(mapItem, templateID);
                }
            }
            else if (contentType == ContentType.Blog)
            {
                mapInfo.OutputMaps = SetBlogMap(mapItem, templateID);
            }
            return(mapInfo);
        }