Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
            }
        }