Ejemplo n.º 1
0
        public KCAPIInventoryItem GetAPIInventoryItem(InventoryItem product)
        {
            DAC.KNSIKCInventoryItem kcProduct = BulkGraph.KCInventoryItem.SelectSingle(product.InventoryID);

            InventoryItemPCExt productPcExt       = product.GetExtension <InventoryItemPCExt>();
            string             classificationName = KCGeneralDataHelper.GetClassificationByInventoryId(ClassificationsGraph, product);

            KCAPIInventoryItem apiProduct = new KCAPIInventoryItem()
            {
                Classification = classificationName
            };

            if (IsConfigurableParentOrChild(product, productPcExt))
            {
                PropagateConfigurable(product, apiProduct, productPcExt.UsrKNCompositeType == null);
            }
            if (productPcExt.UsrKNCompositeType == KCConstants.GroupedProduct)
            {
                PropagateBundle(product, apiProduct);
            }
            if (product.KitItem.GetValueOrDefault())
            {
                PropagateKit(product, apiProduct);
            }

            KCDynamicProductMapper mapper = new KCDynamicProductMapper(KCMappingEntitiesConstants.Product);

            mapper.Mapping.MappingValues = ConversionGraph.GetEntity(product.InventoryCD);
            apiProduct = mapper.MapApiInventoryItem(apiProduct, product, kcProduct);
            apiProduct = KCGeneralDataHelper.FillReservedAttributes(product, apiProduct);

            return(apiProduct);
        }