/// <summary> /// Get the items used in a specific reprocessing job. /// </summary> /// <param name="jobID"></param> /// <returns></returns> public static ReprocessItemList GetJobItems(int jobID) { ReprocessItemList retVal = new ReprocessItemList(); EMMADataSet.ReprocessItemDataTable table = new EMMADataSet.ReprocessItemDataTable(); lock (itemTableAdapter) { itemTableAdapter.FillByJob(table, jobID); } foreach (EMMADataSet.ReprocessItemRow row in table) { retVal.Add(new ReprocessItem(row)); } return retVal; }
/// <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); } }