private void ProcessNodeComponents(TaxonomyInfo node) { // get list of SKUs for this taxonomy var allSkus = node.GetSkus(_args.ExportCrossListNodes); if (!allSkus.Any()) { return; } // filter skus based on sku inclusions and exclusions, then include only Product skus. var skus = _args.GetFilteredSkuList(allSkus).ToList(); ProcessSchema(node); ProcessSkus(node, skus); }
private IEnumerable <Attribute> GetAttributes(AryaDbDataContext dc, TaxonomyInfo currentTaxonomyInfo) { var attributes = new List <Attribute>(); if (Args.LeafNodesOnly && !currentTaxonomyInfo.IsLeafNode) { return(attributes); } if (currentTaxonomyInfo.GetSkus(Args.ExportCrossListNodes).Any(t => t.SkuType == "Product") || Args.ExportEmptyNodes) { if (!currentTaxonomyInfo.IsLeafNode) { var schemaInfos = new List <SchemaInfo>(); schemaInfos.AddRange( currentTaxonomyInfo.SchemaInfos.Where(si => si.SchemaDatas.Any(sd => sd.Active)).ToList()); var schemaAttributes = schemaInfos.Where(p => p.SchemaData.InSchema).Select(p => new { p.Attribute, p.SchemaData }).ToList(); attributes = (from att in schemaAttributes group att by att.Attribute into grp let minRank = grp.Min(p => GetRank(p.SchemaData, SortOrder.OrderbyDisplayNavigation)) orderby minRank select grp.Key).Distinct().ToList(); } else { attributes = (from si in dc.SchemaInfos where si.TaxonomyID == currentTaxonomyInfo.ID let sd = si.SchemaDatas.FirstOrDefault(sd => sd.Active) where sd != null let inSchema = sd.InSchema where inSchema let navRank = sd == null || sd.NavigationOrder == 0 ? decimal.MaxValue : sd.NavigationOrder let dispRank = sd == null || sd.DisplayOrder == 0 ? decimal.MaxValue : sd.DisplayOrder orderby navRank, dispRank select si.Attribute).ToList(); } return(attributes); } return(attributes); }
private void ProcessTaxonomySkus(TaxonomyInfo ti) { //Must use independent DataContext to conserve memory using (var dc = new AryaDbDataContext(Arguments.ProjectId, Arguments.UserId)) { var node = ItemNode.FromValues(ti.ID, ti.ProjectID, ti.ToString(((AdvancedExportArgs)Arguments).IgnoreT1Taxonomy), ti.NodeName); //var allSkus = from si in dc.SkuInfos // where si.Active && si.TaxonomyID == ti.ID // let sku = si.Sku // where sku.SkuType == Sku.ItemType.Product.ToString() // select sku; var allSkus = ti.GetSkus(_args.ExportCrossListNodes); var skus = ((AdvancedExportArgs)Arguments).GetFilteredSkuList(allSkus).ToList(); skus.AsParallel().ForAll(sku => ProcessSku(node, sku)); } }
private List <Attribute> GetAttributes(AryaDbDataContext dc, TaxonomyInfo currentTaxonomyInfo) { var attributes = new List <Attribute>(); if (Args.LeafNodesOnly && !currentTaxonomyInfo.IsLeafNode) { return(attributes); } //if (!Args.ExportEmptyNodes && !currentTaxonomyInfo.GetSkus(Args.ExportCrossListNodes).Any()) //if (!(Args.ExportEmptyNodes || currentTaxonomyInfo.GetSkus(Args.ExportCrossListNodes).Any(t => t.SkuType == "Product"))) if (currentTaxonomyInfo.GetSkus(Args.ExportCrossListNodes).Any(t => t.SkuType == "Product") || Args.ExportEmptyNodes) { if (Args.ExportSuperSchema && !currentTaxonomyInfo.IsLeafNode) { var schemaInfos = new List <SchemaInfo>(); schemaInfos.AddRange( currentTaxonomyInfo.SchemaInfos.Where(si => si.SchemaDatas.Any(sd => sd.Active)).ToList()); if (Args.ExportSuperSchema) { foreach (var leaf in currentTaxonomyInfo.AllLeafChildren) { schemaInfos.AddRange(leaf.SchemaInfos.Where(si => si.SchemaDatas.Any(sd => sd.Active)).ToList()); } } var schemaAttributes = schemaInfos.Where(p => p.SchemaData.InSchema).Select(p => new { p.Attribute, p.SchemaData }).ToList(); attributes = (from att in schemaAttributes group att by att.Attribute into grp let minRank = grp.Min(p => GetRank(p.SchemaData, SortOrder.OrderbyDisplayNavigation)) orderby minRank select grp.Key).Distinct().ToList(); } else { attributes = (from si in dc.SchemaInfos where si.TaxonomyID == currentTaxonomyInfo.ID let sd = si.SchemaDatas.FirstOrDefault(sd => sd.Active) where sd != null let inSchema = sd.InSchema where inSchema let navRank = sd == null || sd.NavigationOrder == 0 ? decimal.MaxValue : sd.NavigationOrder let dispRank = sd == null || sd.DisplayOrder == 0 ? decimal.MaxValue : sd.DisplayOrder orderby navRank, dispRank select si.Attribute).ToList(); var currentTaxonomyString = currentTaxonomyInfo.ToString(); var possibleMissingAttributes = (from si in CurrentDb.SchemaInfos where si.TaxonomyID == currentTaxonomyInfo.ID let sd = si.SchemaDatas.FirstOrDefault(sd => sd.Active) where sd != null && !sd.InSchema && (sd.NavigationOrder > 0 || sd.DisplayOrder > 0) select si.Attribute.AttributeName).ToList().Select(p => currentTaxonomyString + "\t" + p).ToList(); _possibleMissingInSchemaAttributes.AddRange(possibleMissingAttributes); } return(attributes); } return(attributes); }