Created
November 7, 2015 05:01
-
-
Save lanekatris/06ec77d999b9918c4cdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <xsl:stylesheet version="1.0" | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:msxsl="urn:schemas-microsoft-com:xslt" | |
| exclude-result-prefixes="msxsl"> | |
| <xsl:output method="xml" indent="yes"/> | |
| <xsl:template name="Put.InventoryUpdate"> | |
| <AspDotNetStorefrontImport Version="7.1"> | |
| <ExecuteSQL Name="UpdateInventory"> | |
| <xsl:for-each select="Item_Items/Item_Item"> | |
| <SQL> | |
| <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> | |
| update product set quantity = 4 where sku = N'<xsl:value-of select="SKU"></xsl:value-of>'; | |
| -- We should only ever find one inventory value to update | |
| IF @resultCount <xsl:text disable-output-escaping="yes">></xsl:text> 1 | |
| begin | |
| RAISERROR ('THERE WAS AN ERROR, SHOULD ONLY BE ONE INVENTORY VALUE, NOT UPDATING INVENTORY', 16, 1); | |
| end | |
| else if @resultCount = 0 | |
| begin | |
| declare @err nvarchar(500) = 'THERE WAS AN ERROR, NO INVENTORY VALUE WAS FOUND'; | |
| RAISERROR (@err, 16, 1); | |
| end | |
| else | |
| begin | |
| update inventory set Quan = @quantity where InventoryID = (select id from @results); | |
| end | |
| <xsl:text disable-output-escaping="yes">]]></xsl:text> | |
| </SQL> | |
| </xsl:for-each> | |
| </ExecuteSQL> | |
| </AspDotNetStorefrontImport> | |
| </xsl:template> | |
| </xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment