private void AddProductsToTree(AssortmentTree tree, Dictionary <int, List <int> > productsPerProductGroupMapping, Dictionary <int, List <int> > productMapping) { foreach (var mappingGroup in productsPerProductGroupMapping) { tree.AddProducts(mappingGroup.Value, mappingGroup.Key, productMapping, InsertProductsToAllGroups); } }
private void AddChild(AssortmentTree tree, ProductGroupMapping current, List <ProductGroupMapping> productGroupMappings) { tree.AddToTree(current.ProductGroupMappingID, current.ParentProductGroupMappingID, flattenHierarchy: current.FlattenHierarchy, filterByParent: current.FilterByParentGroup); foreach (var childMapping in productGroupMappings.Where(c => c.ParentProductGroupMappingID == current.ProductGroupMappingID)) { AddChild(tree, childMapping, productGroupMappings); } }
public void Setup() { _tree = new AssortmentTree(); _productProductGroupMapping = new Dictionary <int, List <int> >(); for (int i = 0; i < 20000; i++) { _productProductGroupMapping.Add(i, Enumerable.Range(0, 900).ToList()); } }
private AssortmentTree BuildTree(List <ProductGroupMapping> productGroupMappings) { AssortmentTree tree = new AssortmentTree(); foreach (var mapping in productGroupMappings.Where(c => c.ParentProductGroupMappingID == null).ToList()) { //roots tree.AddToTree(mapping.ProductGroupMappingID, flattenHierarchy: mapping.FlattenHierarchy, filterByParent: mapping.FilterByParentGroup); foreach (var childMapping in productGroupMappings.Where(c => c.ParentProductGroupMappingID == mapping.ProductGroupMappingID)) { AddChild(tree, childMapping, productGroupMappings); } } return(tree); }
private void AddProductsToTree(AssortmentTree tree, Dictionary <int, List <int> > productsPerProductGroupMapping, List <Content> Contents, Dictionary <int, List <int> > MappingProductGroup) { var productMapping = (from c in Contents select new { c.ProductID, ProductGroupMappings = (from pg in c.ProductGroupVendors where MappingProductGroup.ContainsKey(pg) select MappingProductGroup[pg]).SelectMany(pg => pg).ToList() }).ToDictionary(c => c.ProductID, c => c.ProductGroupMappings); foreach (var mappingGroup in productsPerProductGroupMapping) { tree.AddProducts(mappingGroup.Value, mappingGroup.Key, productMapping, false); } }
private void AddChild(AssortmentTree tree, MasterGroupMapping current, IEnumerable <MasterGroupMapping> mappings) { var retainProducts = false; var retainProductsSetting = current.MasterGroupMappingSettingValues.FirstOrDefault(x => x.MasterGroupMappingSetting.Name == "Retain Products"); if (retainProductsSetting != null) { bool.TryParse(retainProductsSetting.Value, out retainProducts); } tree.AddToTree(current.MasterGroupMappingID, current.ParentMasterGroupMappingID, flattenHierarchy: current.FlattenHierarchy, filterByParent: current.FilterByParentGroup, retainProducts: retainProducts); foreach (var childMapping in mappings.Where(c => c.ParentMasterGroupMappingID == current.MasterGroupMappingID)) { AddChild(tree, childMapping, mappings); } }
private AssortmentTree BuildTree(IEnumerable <MasterGroupMapping> mappings) { var tree = new AssortmentTree(); foreach (var mapping in mappings.Where(c => c.ParentMasterGroupMappingID == null).ToList()) { var retainProducts = false; var retainProductsSetting = mapping.MasterGroupMappingSettingValues.FirstOrDefault(x => x.MasterGroupMappingSetting.Name == "Retain Products"); if (retainProductsSetting != null) { bool.TryParse(retainProductsSetting.Value, out retainProducts); } tree.AddToTree(mapping.MasterGroupMappingID, flattenHierarchy: mapping.FlattenHierarchy, filterByParent: mapping.FilterByParentGroup, retainProducts: retainProducts); foreach (var childMapping in mappings.Where(c => c.ParentMasterGroupMappingID == mapping.MasterGroupMappingID)) { AddChild(tree, childMapping, mappings); } } return(tree); }
public void Setup() { _tree = new AssortmentTree(); }