Пример #1
0
        public int Save(SystemSessionLog log)
        {
            //将之前的登录状态清空掉

            SystemSessionLog oldLog = new SystemSessionLog();

            oldLog.RecordStatus = Sharp.Common.StatusType.update;
            oldLog.Where        = SystemSessionLog._.UserID == log.UserID && SystemSessionLog._.EntryStats == "在线";
            oldLog.OutDate      = Dal.SystemDateTime;
            int            result = 0;
            SessionFactory dal    = null;
            IDbTransaction tr     = Dal.BeginTransaction(out dal);

            try
            {
                dal.Update(oldLog, null, tr);
                result = dal.SubmitNew(tr, ref dal, log);
                dal.CommitTransaction(tr);
            }
            catch (Exception)
            {
                dal.RollbackTransaction(tr);
                throw;
            }
            return(result);
        }