Пример #1
0
 public Category(long id, ICategoryInfo categoryInfo)
 {
     _id = id;
     _name = categoryInfo.Name;
 }
Пример #2
0
 public IEnumerable<ICategory> CreateCategory(ICategoryInfo categoryInfo)
 {
     // NOTE : Requires a .ToList() here so that we force all to be created
     return CreateCategory(categoryInfo, null).ToList();
 }
Пример #3
0
 public ICategory CreateCategory(ICategoryInfo categoryInfo)
 {
     return new Category(GetNextIndex(), categoryInfo);
 }
Пример #4
0
        private IEnumerable<ICategory> CreateCategory(ICategoryInfo categoryInfo, ICategory parentCategory)
        {
            var category = CategoryFactoryService.CreateCategory(categoryInfo);
            _idIndex.Add(category.Id, category);
            _nameIndex.Add(category.Name, category);
            _labelIndex.Put(category.Name, category.Id);

            if (parentCategory != null)
            {
                if (!_isAIndex.ContainsKey(category.Id))
                    _isAIndex.Add(category.Id, new List<long>());
                _isAIndex[category.Id].Add(parentCategory.Id);

                if (!_isAIndexInverse.ContainsKey(parentCategory.Id))
                    _isAIndexInverse.Add(parentCategory.Id, new List<long>());
                _isAIndexInverse[parentCategory.Id].Add(category.Id);
            }

            yield return category;

            foreach (var childCategoryInfo in categoryInfo.Children)
            {
                var childCategories = CreateCategory(childCategoryInfo, category);
                foreach (var childCategory in childCategories)
                    yield return childCategory;
            }
        }
Пример #5
0
 public CategoryInfo(ICategoryInfo data) :
     base(data, typeof(ICategoryInfo))
 {
 }