public bool UpdateInventoryBOM(int?InventoryBOMsID, int?InventoryBOMsRawMatID, int?InventoryBOMsInventoryID, float?InventoryBOMsQuantity, double?scrapFactor) { SPG.InventoryBOMsDataTable inventoryBOMs = Adapter.GetInventoryBOMByID(InventoryBOMsID.Value); if (!InventoryBOMsRawMatID.HasValue) { throw new ApplicationException("You must provide a RM ID."); } if (!InventoryBOMsQuantity.HasValue || InventoryBOMsQuantity.Value == 0) { throw new ApplicationException("You must provide the Quantity Used."); } if (inventoryBOMs.Count() == 0) { //It is a new Product return(InsertInventoryBOM(InventoryBOMsRawMatID, InventoryBOMsInventoryID, InventoryBOMsQuantity, scrapFactor)); } SPG.InventoryBOMsRow inventoryBOM = inventoryBOMs[0]; object[] originalRecord = inventoryBOM.ItemArray; SetInventoryBOMFields(InventoryBOMsRawMatID, InventoryBOMsInventoryID, InventoryBOMsQuantity, scrapFactor, inventoryBOM); if (!(originalRecord == null)) { UpdateAuditTrail(inventoryBOM, originalRecord); } int rowsAffected = Adapter.Update(inventoryBOM); return(rowsAffected == 1); }
public bool InsertInventoryBOM(int?InventoryBOMsRawMatID, int?InventoryBOMsInventoryID, float?InventoryBOMsQuantity, double?scrapFactor) { SPG.InventoryBOMsDataTable inventoryBOMs = new SPG.InventoryBOMsDataTable(); SPG.InventoryBOMsRow inventoryBOM = inventoryBOMs.NewInventoryBOMsRow(); SetInventoryBOMFields(InventoryBOMsRawMatID, InventoryBOMsInventoryID, InventoryBOMsQuantity, scrapFactor, inventoryBOM); inventoryBOMs.AddInventoryBOMsRow(inventoryBOM); int rowsAffected = Adapter.Update(inventoryBOMs); return(rowsAffected == 1); }