public static int CurrentTransactionNo(Context context) { ICriteria crit = context.PersistenceSession.CreateCriteria(typeof(RunningNumber)); crit.Add(Expression.Eq("Code", "TransactionNo")); RunningNumber runNumber = crit.UniqueResult <RunningNumber>(); int next = runNumber.Next; return(next); }
public static int NextMLSID(Context context) { ICriteria crit = context.PersistenceSession.CreateCriteria(typeof(RunningNumber)); crit.Add(Expression.Eq("Code", "MultilingualString")); RunningNumber runNumber = crit.UniqueResult <RunningNumber>(); int next = runNumber.Next; runNumber.Next++; context.PersistenceSession.Update(runNumber); return(next); }
public static int UpdateTransactionNo(Context context, int number) { ICriteria crit = context.PersistenceSession.CreateCriteria(typeof(RunningNumber)); crit.Add(Expression.Eq("Code", "TransactionNo")); RunningNumber runNumber = crit.UniqueResult <RunningNumber>(); int next = runNumber.Next; if (next == number) { runNumber.Next++; context.PersistenceSession.Update(runNumber); return(number); } else { return(next); } }