Esempio n. 1
0
        public BeforeSyncCategory(BeforeSyncCategory parentSyncCat, category category)
        {
            Childs = new List<BeforeSyncCategory>();
            Products = new List<BeforeSyncProduct>();

            Id = (int)category.id;
            Title = category.name[0].Value;

            Base = category;

            Parent = parentSyncCat;
            if (parentSyncCat != null) parentSyncCat.Childs.Add(this);
        }
Esempio n. 2
0
        private BeforeSyncCategory BuildTree(BeforeSyncCategory parentSyncCat, category category)
        {
            var beforeSyncCategory = new BeforeSyncCategory(parentSyncCat, category);

            var products = StoreProducts.Where(p => p.id_category_default == category.id).ToList();
            foreach (product product in products)
            {
                var beforeSyncProduct = new BeforeSyncProduct(beforeSyncCategory, product);
            }

            var childCategories = StoreCategories.Where(c => c.id_parent == category.id).ToList();
            foreach (category child in childCategories)
            {
                BuildTree(beforeSyncCategory, child);
            }

            return beforeSyncCategory;
        }