private void MapImportData(ItemImportMap map, ImportItemsArgs args, ItemDto rootItem, DataTable dataImport, bool isSpecialEvent = false) { if (map != null) { foreach (var outputMap in map.OutputMaps) { ImportMapItems(args, dataImport, outputMap, rootItem, true, isSpecialEvent); //ick } } }
public override void Process(ImportItemsArgs args) { var rootItem = new ItemDto("<root>"); //ick if (args.ContentType != ContentType.Article.ToString()) { ItemImportMap map = null; if (args.ContentType == ContentType.Store.ToString()) { var mapItem = Factory.SetMapInputField(ContentType.Store.ToString(), Templates.Store.ID); map = Factory.BuildMapInfo(mapItem, Templates.Store.ID, ContentType.Store); } else if (args.ContentType == ContentType.Banner.ToString()) { var mapItem = Factory.SetMapInputField(ContentType.Banner.ToString(), Templates.Banner.ID); map = Factory.BuildMapInfo(mapItem, Templates.Banner.ID, ContentType.Banner); } else if (args.ContentType == ContentType.Event.ToString()) { var mapItem = Factory.SetMapInputField(ContentType.Event.ToString(), Templates.Event.ID); map = Factory.BuildMapInfo(mapItem, Templates.Event.ID, ContentType.Event); } else if (args.ContentType == ContentType.Blog.ToString()) { var mapItem = Factory.SetMapInputField(ContentType.Blog.ToString(), FrasersContent.Templates.Blog.ID); map = Factory.BuildMapInfo(mapItem, FrasersContent.Templates.Blog.ID, ContentType.Blog); } if (map != null) { args.Map.Add(map); } MapImportData(map, args, rootItem, args.ImportDatas[0]); } else { var mapArticleItem = Factory.SetMapInputField(ContentType.Article.ToString(), Templates.Article.ID); var articleMap = Factory.BuildMapInfo(mapArticleItem, Templates.Article.ID, ContentType.Article); args.Map.Add(articleMap); MapImportData(articleMap, args, rootItem, args.ImportDatas[0]); var mapSpecialItem = Factory.SetMapInputField(ContentType.Article.ToString(), FrasersContent.Templates.SpecialEvent.ID); var specialMap = Factory.BuildMapInfo(mapSpecialItem, FrasersContent.Templates.SpecialEvent.ID, ContentType.Article); args.Map.Add(specialMap); MapImportData(specialMap, args, rootItem, args.ImportDatas[1], true); } args.ImportItems.AddRange(rootItem.Children); //ick }