Beispiel #1
0
        /// <summary>
        /// 检查会话是否过期:
        /// </summary>
        /// <param name="loginName"></param>
        /// <returns>false:已过期;true:未过期</returns>
        public bool CheckSessionIsExpired(string loginName, out string sessionKey)
        {
            sessionKey = string.Empty;
            //到日志表中查询数据,若是有就延长会话时间,否则新加入日志
            var log = loginLogDao.QueryLogByLoginName(loginName, 1, "DESC").FirstOrDefault();

            if (log != null)
            {
                sessionKey = log.SessionKey;
                if (DateTime.Now.Subtract(log.CreateTime).TotalMinutes > Convert.ToInt32(ConfigurationManager.AppSettings["ExpiredTime"]))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 public IList <AccountLog> QueryLogByLoginName(string loginName, int top, string order = "DESC")
 {
     return(loginLogDao.QueryLogByLoginName(loginName, top, order));
 }