public ExecResult DeleteLoginErrorLog(LoginErrorLogQuery loginErrorLogQuery) { ExecResult result = new ExecResult(); try { ILoginService loginService = ServiceContainer.Instance.Container.Resolve<ILoginService>(); bool flag = loginService.DeleteLoginErrorLog(loginErrorLogQuery); if( flag ) { result.result = EnumJsonResult.success.ToString(); result.msg = "成功"; } else { result.result = EnumJsonResult.failure.ToString(); result.msg = "操作失败,请确认登录信息是否正确"; } } catch( Exception ex ) { result.result = EnumJsonResult.error.ToString(); result.msg = "记录登录错误日志信息时出现异常:" + ex.Message; } return result; }
public IList<LoginErrorLogEntity> GetLoginErrorLogList(LoginErrorLogQuery loginErrorLogQuery) { try { ILoginService loginService = ServiceContainer.Instance.Container.Resolve<ILoginService>(); IList<LoginErrorLogEntity> listLoginErrorLog = loginService.GetLoginErrorLogList(loginErrorLogQuery); return listLoginErrorLog; } catch (Exception ex) { LogProvider.Instance.Error("获取登录错误日志信息出现异常:" + ex.Message); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.Message)); } }
public bool DeleteLoginErrorLog(LoginErrorLogQuery loginErrorLogQuery) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("DELETE FROM dbo.LoginErrorLog"); sqlCommandText.Append(" WHERE JournalID=@JournalID AND LoginName=@LoginName"); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); db.AddInParameter(cmd, "@JournalID", DbType.Int64, loginErrorLogQuery.JournalID); db.AddInParameter(cmd, "@LoginName", DbType.String, loginErrorLogQuery.LoginName); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
public List<LoginErrorLogEntity> GetLoginErrorLogList(LoginErrorLogQuery loginErrorLogQuery) { return LoginBusProvider.GetLoginErrorLogList(loginErrorLogQuery); }
/// <summary> /// 获取一个实体对象 /// </summary> /// <param name="query"></param> /// <returns></returns> public LoginErrorLogEntity GetLoginErrorLogInfo(LoginErrorLogQuery query) { return LoginBusProvider.GetLoginErrorLogInfo(query); }
public bool DeleteLoginErrorLog(LoginErrorLogQuery loginErrorLogQuery) { return LoginBusProvider.DeleteLoginErrorLog(loginErrorLogQuery); }
/// <summary> /// 获取所有符合查询条件的数据 /// </summary> /// <param name="authorInfoQuery">AuthorInfoQuery查询实体对象</param> /// <returns>List<AuthorInfoEntity></returns> public List<LoginErrorLogEntity> GetLoginErrorLogList(LoginErrorLogQuery loginErrorLogQuery) { return LoginDataAccess.Instance.GetLoginErrorLogList(loginErrorLogQuery); }
/// <summary> /// 获取登录错误日志信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public LoginErrorLogEntity GetLoginErrorLogInfo(LoginErrorLogQuery query) { return LoginDataAccess.Instance.GetLoginErrorLogInfo(query); }
/// <summary> /// 从存储媒介删除实体数据 /// </summary> /// <param name="authorID">作者信息</param> /// <returns>true:删除成功 false:删除失败</returns> public bool DeleteLoginErrorLog(LoginErrorLogQuery loginErrorLogQuery) { return LoginDataAccess.Instance.DeleteLoginErrorLog(loginErrorLogQuery); }
public IList<LoginErrorLogEntity> GetLoginErrorLogList(LoginErrorLogQuery loginErrorLogQuery) { HttpClientHelper clientHelper = new HttpClientHelper(); IList<LoginErrorLogEntity> loginErrorLogList = clientHelper.PostAuth<IList<LoginErrorLogEntity>, LoginErrorLogQuery>(GetAPIUrl(APIConstant.GETLOGINERRORLOGLIST), loginErrorLogQuery); return loginErrorLogList; }
public ExecResult DeleteLoginErrorLog(LoginErrorLogQuery loginErrorLogQuery) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult execResult = clientHelper.PostAuth<ExecResult, LoginErrorLogQuery>(GetAPIUrl(APIConstant.DELETELOGINERRORLOG), loginErrorLogQuery); return execResult; }
/// <summary> /// 将查询实体转换为Where语句 /// <param name="query">查询实体</param> /// <returns>获取Where语句,不包含Where</returns> /// </summary> public string LoginQueryToSQLWhere(LoginErrorLogQuery query) { StringBuilder sbWhere = new StringBuilder(" JournalID = " + query.JournalID); if (!string.IsNullOrWhiteSpace(query.LoginName)) { sbWhere.Append(" AND LoginName = '").Append(query.LoginName).Append("'"); } if (!string.IsNullOrWhiteSpace(query.LoginIP)) { sbWhere.Append(" AND LoginIP = '").Append(query.LoginIP).Append("'"); } if (!string.IsNullOrWhiteSpace(query.LoginHost)) { sbWhere.Append(" AND LoginHost = '").Append(query.LoginHost).Append("'"); } return sbWhere.ToString(); }
/// <summary> /// 将查询实体转换为Order语句 /// <param name="query">查询实体</param> /// <returns>获取Order语句,不包含Order</returns> /// </summary> public string LoginQueryToSQLOrder(LoginErrorLogQuery query) { return " PKID DESC"; }
public List<LoginErrorLogEntity> GetLoginErrorLogList(LoginErrorLogQuery query) { List<LoginErrorLogEntity> list = new List<LoginErrorLogEntity>(); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT * FROM dbo.LoginErrorLog WITH(NOLOCK)"); string whereSQL = LoginQueryToSQLWhere(query); string orderBy = LoginQueryToSQLOrder(query); if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL); if (!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); using (IDataReader dr = db.ExecuteReader(cmd)) { list = MakeLoginList(dr); } return list; }
/// <summary> /// 获取登录错误日志信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public LoginErrorLogEntity GetLoginErrorLogInfo(LoginErrorLogQuery query) { LoginErrorLogEntity loginErrorLogEntity = null; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT TOP 1 * FROM dbo.LoginErrorLog WITH(NOLOCK)"); string whereSQL = LoginQueryToSQLWhere(query); if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); using (IDataReader dr = db.ExecuteReader(cmd)) { loginErrorLogEntity = MakeLogin(dr); } return loginErrorLogEntity; }