Exemple #1
0
 public bool Equals(Level1 other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.Id == other.Id);
 }
Exemple #2
0
        public static IEnumerable <Category> BuildTree(IEnumerable <ResultSet> results)
        {
            Category category = null;
            Family   family   = null;
            Series   series   = null;
            Level1   level1   = null;
            Level2   level2   = null;

            foreach (var result in results)
            {
                string categoryId     = result.CategoryId;
                string familyId       = result.FamilyId;
                string seriesId       = result.SeriesId;
                string level1Id       = result.Level1Id;
                string level2Id       = result.Level2Id;
                string styleId        = result.StyleId;
                string priceListId    = result.PriceListId;
                string stockGroupId   = result.StockGroupId;
                string supplyStatusId = result.SupplyingStatusId;
                if (!_list.ContainsKey(categoryId))
                {
                    category = new Category()
                    {
                        Id = categoryId
                    };
                    _list.Add(categoryId, category);
                }
                else
                {
                    category = _list[categoryId];
                }
                family = category.CreateOrGet(familyId);
                series = family.CreateOrGet(seriesId);
                level1 = series.CreateOrGet(level1Id);
                level2 = level1.CreateOrGet(level2Id);
                level2.CreateOrGet(styleId);
                level2.CreateOrGet(new PriceList()
                {
                    Id = priceListId
                });
                level2.CreateOrGet(new StockGroup()
                {
                    Id = stockGroupId
                });
                level2.CreateOrGet(new SupplyStatus()
                {
                    Id = supplyStatusId
                });
            }

            return(_list.Values);
        }
Exemple #3
0
        public Level1 CreateOrGet(string level1Id)
        {
            if (level1Id == null)
            {
                throw new ArgumentNullException();
            }
            Level1 level1 = new Level1()
            {
                Id = level1Id
            };

            if (!_list.Contains(level1))
            {
                _list.Add(level1);
            }
            return(level1);
        }