コード例 #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);
        }
コード例 #2
0
ファイル: BeforeSyncForm.cs プロジェクト: poolsar/LotCreator
 public BeforeSyncCatNode(BeforeSyncCategory @base)
 {
     Base = @base;
 }
コード例 #3
0
        public BeforeSyncProduct(BeforeSyncCategory beforeSyncCategory, product product)
        {
            Id = (int)product.id;
            Title = product.name[0].Value;

            Base = product;

            Category = beforeSyncCategory;
            beforeSyncCategory.Products.Add(this);
        }
コード例 #4
0
        private void Save(BeforeSyncCategory category)
        {
            if (!category.Checked)
            {
                CategoryFactory.Delete(category.Base);
            }

            foreach (var product in category.Products)
            {
                Save(product);
            }

            foreach (var child in category.Childs)
            {
                Save(child);
            }
        }
コード例 #5
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;
        }