/// <summary>
 /// Store the specified reprocess job item.
 /// Note that this method will ALWAYS try to create a new row. If one already exists in
 /// the database with the same job and item IDs then an EMMADataException is thrown.
 /// </summary>
 /// <param name="itemData">The item data to store</param>
 /// <exception cref="EMMADataException"></exception>
 private static void StoreItem(ReprocessItem itemData)
 {
     EMMADataSet.ReprocessItemDataTable table = new EMMADataSet.ReprocessItemDataTable();
     EMMADataSet.ReprocessItemRow row = table.NewReprocessItemRow();
     row.JobID = itemData.JobID;
     row.ItemID = itemData.ItemID;
     row.Quantity = itemData.Quantity;
     row.BuyPrice = itemData.BuyPrice;
     table.AddReprocessItemRow(row);
     try
     {
         lock (itemTableAdapter)
         {
             itemTableAdapter.Update(table);
         }
     }
     catch (Exception ex)
     {
         throw new EMMADataException(ExceptionSeverity.Error, "Problem adding reprocess result data " +
             "to the database.", ex);
     }
 }
 public void AddItem(int itemID, long quantity, decimal totalBuyPrice)
 {
     ReprocessItem itemData = null;
     for (int i = 0; i < _items.Count; i++)
     {
         if (_items[i].ItemID == itemID)
         {
             itemData = _items[i];
             i = _items.Count;
         }
     }
     if (itemData == null)
     {
         itemData = new ReprocessItem(_id, itemID, quantity, totalBuyPrice);
         _items.Add(itemData);
     }
     else
     {
         itemData.Quantity += quantity;
         itemData.BuyPrice += totalBuyPrice;
     }
     _gotItemsBuyPrice = false;
 }