コード例 #1
0
        public void PropagateKit(InventoryItem product, KCAPIInventoryItem apiProduct)
        {
            List <KCAPIBundleComponent> bundleComponents = new List <KCAPIBundleComponent>();

            INKitSpecHdr kit = BulkGraph.KitProduct.SelectSingle(product.InventoryID);

            foreach (INKitSpecStkDet component in BulkGraph.StockKitComponents.Select(product.InventoryID, kit.RevisionID))
            {
                if (!ComponentIsActive(component.CompInventoryID))
                {
                    continue;
                }

                bundleComponents.Add(new KCAPIBundleComponent()
                {
                    ComponentSku = BulkGraph.ItemById.SelectSingle(component.CompInventoryID).InventoryCD.Trim(),
                    Quantity     = Convert.ToInt32(component.DfltCompQty)
                });
            }

            foreach (INKitSpecNonStkDet component in BulkGraph.NonStockKitComponents.Select(product.InventoryID, kit.RevisionID))
            {
                if (!ComponentIsActive(component.CompInventoryID))
                {
                    continue;
                }

                bundleComponents.Add(new KCAPIBundleComponent()
                {
                    ComponentSku = BulkGraph.ItemById.SelectSingle(component.CompInventoryID).InventoryCD.Trim(),
                    Quantity     = Convert.ToInt32(component.DfltCompQty)
                });
            }

            DeleteObsoleteBundleComponents(bundleComponents, product);

            apiProduct.BundleType       = "BundleItem";
            apiProduct.BundleComponents = bundleComponents;
        }