/// <summary> /// 修改cas登录日志 /// </summary> /// <param name="casLogEntity">实体对象</param> public bool Update(CasLogEntity casLogEntity) { using (_connection = _DbFactory.GetOpenConnection()) { return(_connection.Update <CasLogEntity>(casLogEntity) == 1); } }
/// <summary> /// 保存cas登录日志 /// </summary> /// <param name="casLogEntity">实体对象</param> /// <returns></returns> public bool Save(CasLogEntity casLogEntity) { using (_connection = _DbFactory.GetOpenConnection()) { string query = "insert into [T_SsoCasSession] ([CasLogId], [UserId], [UserAccount], [UserName], [IPAddress], [LoginTime], [LogoutTime], [LogStatus], [BrowserType], [SESSIONID], [Description]) values (@CasLogId, @UserId, @UserAccount, @UserName, @IPAddress, @LoginTime, @LogoutTime, @LogStatus, @BrowserType, @SESSIONID, @Description)"; return(_connection.Execute(query, casLogEntity) == 1); //return _connection.Insert<CasLogEntity>(casLogEntity) == 1; } }
/// <summary> /// 退出时修改cas日志 /// </summary> /// <returns></returns> public static bool casLogoutLog(UserModel user) { CasLogService casLogService = new CasLogService(); CasLogEntity log = casLogService.GetCasLog(user.CasLogId); log.LogStatus = 0; log.LogoutTime = DateTime.Now; return(casLogService.Update(log)); }
/// <summary> /// 账号密码登录 /// </summary> /// <param name="account"></param> /// <param name="password"></param> /// <returns></returns> public virtual UserModel CheckLogin(string account, string password) { BaseUserEntity _entity = DataBaseUtils.GetUserEntity(account, password); CasLogEntity log = DataBaseUtils.casLoginLog(_entity); UserModel user = new UserModel(); user.UserId = _entity.UserId; user.Account = _entity.Account; user.Password = _entity.Password; user.UserName = _entity.RealName; user.Code = _entity.EnCode; user.LogTime = DateTime.Now; user.CasLogId = log == null ? "" : log.CasLogId; return(user); }
/// <summary> /// 新增cas登录日志 /// </summary> /// <returns></returns> public static CasLogEntity casLoginLog(BaseUserEntity user) { CasLogService casLogService = new CasLogService(); CasLogEntity log = new CasLogEntity(); log.Create(); log.UserId = user.UserId; log.UserAccount = user.Account; log.UserName = user.RealName; log.BrowserType = WebHelperUtils.Browser; log.IPAddress = WebHelperUtils.Ip; log.SESSIONID = UserUtils.Provider.getCurrentSession(); return(casLogService.Save(log) ? log : null); }