/// <summary> /// Get a list of reprocess results that produced the specified item for the /// specified report group. /// </summary> /// <param name="itemID"></param> /// <param name="reportGroupID"></param> /// <returns></returns> public static ReprocessResultList GetItemResults(int itemID, int reportGroupID) { ReprocessResultList retVal = new ReprocessResultList(); EMMADataSet.ReprocessResultDataTable table = new EMMADataSet.ReprocessResultDataTable(); lock (resultTableAdapter) { resultTableAdapter.FillByGroupAndItem(table, itemID, reportGroupID); } foreach (EMMADataSet.ReprocessResultRow row in table) { retVal.Add(new ReprocessResult(row)); } return retVal; }
/// <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); } }
/// <summary> /// Get the results of a specific reprocessing job. /// </summary> /// <param name="jobID"></param> /// <returns></returns> public static ReprocessResultList GetJobResults(int jobID) { ReprocessResultList retVal = new ReprocessResultList(); EMMADataSet.ReprocessResultDataTable table = new EMMADataSet.ReprocessResultDataTable(); lock (resultTableAdapter) { resultTableAdapter.FillByJob(table, jobID); } foreach (EMMADataSet.ReprocessResultRow row in table) { retVal.Add(new ReprocessResult(row)); } return retVal; }