<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Asp.net C# stock level problem?</title>
	<atom:link href="http://www.techanorak.com/27/aspnet-c-stock-level-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techanorak.com/27/aspnet-c-stock-level-problem/</link>
	<description>Articles and discussion on ecommerce solutions</description>
	<lastBuildDate>Wed, 14 Jul 2010 09:39:07 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Daniel B</title>
		<link>http://www.techanorak.com/27/aspnet-c-stock-level-problem/comment-page-1/#comment-813</link>
		<dc:creator>Daniel B</dc:creator>
		<pubDate>Tue, 30 Jun 2009 15:34:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.techanorak.com/programming-design/aspnet-c-stock-level-problem/#comment-813</guid>
		<description>Yes, it would be a good idea to do the stock reduction in the same stored procedure as you do the add to cart. This is especially important since both of these actions should be done within a transaction. If you don&#039;t do a transaction, and two people try to buy the same product at the same time, you could end up with a situation where there is only one item left in inventory and both people end up with it in their shopping carts. 

Your algorithm shows that you are dealing with a case where your inventory can go negative. In real world inventory systems there are reasons to allow this, but in a simple e-commerce site you may not want that to ever happen. 

If the product table is the only source for all your product information, then yes, you do NOT want to delete the item when the quantity reaches zero, because you would have no way of getting the product back then you put more into inventory. Also, you may still want to display the product to the users and just mark it sold out. 

I</description>
		<content:encoded><![CDATA[<p>Yes, it would be a good idea to do the stock reduction in the same stored procedure as you do the add to cart. This is especially important since both of these actions should be done within a transaction. If you don&#8217;t do a transaction, and two people try to buy the same product at the same time, you could end up with a situation where there is only one item left in inventory and both people end up with it in their shopping carts. </p>
<p>Your algorithm shows that you are dealing with a case where your inventory can go negative. In real world inventory systems there are reasons to allow this, but in a simple e-commerce site you may not want that to ever happen. </p>
<p>If the product table is the only source for all your product information, then yes, you do NOT want to delete the item when the quantity reaches zero, because you would have no way of getting the product back then you put more into inventory. Also, you may still want to display the product to the users and just mark it sold out. </p>
<p>I</p>
]]></content:encoded>
	</item>
</channel>
</rss>
