/*
Function Packaging: Kevin Lincecum
Credit goes to Tim Shoemaker and Jose Gomez.
See this thread for much more information: https://www.epiusers.help/t/auto-numbering-customer-id/43884/10
*/
//ref: Bring in Ice.Lib.NextValue
//These sequences are GLOBAL (All Companies)
//No empty keys
if(String.IsNullOrEmpty(sequenceKey) == true) return;
if(String.IsNullOrWhiteSpace(sequenceKey) == true) return;
//Careful here..
using (ErpContext dbContext = Ice.Services.ContextFactory.CreateContext<ErpContext>()) //Erp Context
{
Ice.Lib.NextValue.SetSequenceCurrentValue( dbContext, sequenceKey, ( newValue >= 0 ? newValue : 0 ) );
};