title: linq case statement
body: <p>I need some help with CASE statements in linq (c#):</p>
  
  <pre><code>osc_products.products_quantity =
        CASE 
           WHEN itempromoflag &lt;&gt; 'N' THEN 100000
           WHEN itemcat1 IN ('1','2','31') AND itemsalestatus = 'S' THEN 100000
           WHEN itemsalestatus = 'O' THEN 0
           ELSE cds_oeinvitem.itemqtyonhand - cds_oeinvitem.itemqtycommitted 
        END  
  </code></pre>
  
  <p>My start at converting to linq, (I'm still learning):</p>
  
  <blockquote>
  <pre><code>cdsDBDataContext db = new cdsDBDataContext();
    var query = from items in db.cdsItems
                where items.ItemHandHeldFlag.Equals("Y") &amp;&amp; 
                items.ItemQtyOnHand -  items.ItemQtyCommitted &gt; 0
    select items;
  </code></pre>
  </blockquote>
  
  <p>This query updates stock status from production to a commerce site.</p>