示例#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);
        }
示例#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);
        }
示例#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);
            }
        }