/// <summary> /// Store the specified reprocess job result. /// 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 result data to be stored</param> /// <exception cref="EMMADataException"></exception> private static void StoreResult(ReprocessResult resultData, DateTime jobDate) { EMMADataSet.ReprocessResultDataTable table = new EMMADataSet.ReprocessResultDataTable(); EMMADataSet.ReprocessResultRow row = table.NewReprocessResultRow(); row.JobID = resultData.JobID; row.ItemID = resultData.ItemID; row.Quantity = resultData.Quantity; row.EffectiveBuyPrice = resultData.EffectiveBuyPrice; row.EstSellPrice = resultData.EstSellPrice; row.JobDate = jobDate; table.AddReprocessResultRow(row); try { lock (resultTableAdapter) { resultTableAdapter.Update(table); } } catch (Exception ex) { throw new EMMADataException(ExceptionSeverity.Error, "Problem adding reprocess result data " + "to the database.", ex); } }
public void AddResult(int itemID, long maxQuantity) { if (_resultIDs.Contains(itemID)) { for (int i = 0; i < _results.Count; i++) { if (_results[i].ItemID == itemID) { _results[i].MaxQuantity += maxQuantity; i = _results.Count; } } } else { ReprocessResult newResult = new ReprocessResult(_id, itemID, maxQuantity); if (_defaultResultPrices.ContainsKey(itemID)) { newResult.UnitSellPrice = _defaultResultPrices[itemID]; } _results.Add(newResult); _resultIDs.Add(itemID); } }