private void searchBtn_Click(object sender, EventArgs e) { noDataLabel.Visible = false; searchBtn.Enabled = false; // 清除上次查询的数据 logDataList.Rows.Clear(); m_parm = new LogSearchParam(); m_parm.BeginTime = dateTimeStart.Value; m_parm.EndTime = dateTimeEnd.Value; CheckTime ret = DataModel.Common.CheckDataTime(dateTimeStart.Value, dateTimeEnd.Value); if (ret == CheckTime.START_INVALID) { MessageBox.Show("开始时间不正常!"); return; } else if (ret == CheckTime.END_INVALID) { MessageBox.Show("结束时间不正常!"); return; } m_parm.LogLevel = GetLogLevel(); m_parm.LogType = GetLogType(); // 默认使用降序 m_parm.SortKind = E_VDA_LOG_SORT_TYPE.E_LOG_SORT_TYPE_TIME_DESC; m_parm.OptName = this.opeName.Text; m_parm.StartMum = 0; m_parm.LogCount = 100; m_Vm.GetLogInfoList(m_parm); SearchStart = true; }
/// <summary> /// 获取日志列表 /// </summary> /// <param name="entity">日志搜索实体</param> /// <returns>PageDataModel<LogEntity></returns> public Task <BasePagedListModel <LogEntity> > GetListAsync(LogSearchParam param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } return(logRepository.GetListAsync(param)); }
public async Task <IActionResult> GetGridJson(LogSearchParam param) { BasePagedListModel <LogEntity> pageDataModel = await logService.GetListAsync(param); var data = new { total = pageDataModel.Total, rows = pageDataModel.Data }; return(Json(data)); }
/*=========================================================== * 功 能:获取日志信息 * 参 数: tLogSearchFilter - 日志检索条件 * pdwLogQueryHandle - 日志检索句柄 * 返回值:成功返回TRUE,失败返回FALSE * ===========================================================*/ public bool LogSearch(LogSearchParam param) { TLOG_SEARCH_FILTER tLogSearchFilter = new TLOG_SEARCH_FILTER(); tLogSearchFilter.dwBeginTime = Model.ModelParser.ConvertLinuxTime(param.BeginTime); tLogSearchFilter.dwEndTime = Model.ModelParser.ConvertLinuxTime(param.EndTime); tLogSearchFilter.dwLogCount = param.LogCount; tLogSearchFilter.dwLogLevel = (uint)param.LogLevel; tLogSearchFilter.dwLogType = (uint)param.LogType; tLogSearchFilter.dwOptId = param.OptId; tLogSearchFilter.dwOptType = (uint)param.OptType; tLogSearchFilter.dwSortKind = (uint)param.SortKind; tLogSearchFilter.qwLogSqlId = param.LogId; MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, string.Format("IVXSDKProtocol VdaSdk_LogSearch dwBeginTime:{0}" + ",dwEndTime:{1}" + ",dwLogCount:{2}" + ",dwLogLevel:{3}" + ",dwLogType:{4}" + ",dwOptId:{5}" + ",dwOptType:{6}" + ",dwSortKind:{7}" + ",qwLogSqlId:{8}" , tLogSearchFilter.dwBeginTime , tLogSearchFilter.dwEndTime , tLogSearchFilter.dwLogCount , tLogSearchFilter.dwLogLevel , tLogSearchFilter.dwLogType , tLogSearchFilter.dwOptId , tLogSearchFilter.dwOptType , tLogSearchFilter.dwSortKind , tLogSearchFilter.qwLogSqlId )); bool retVal = IVXSDKProtocol.VdaSdk_LogSearch(tLogSearchFilter); if (!retVal) { // 调用失败,抛异常 CheckError(); } MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXSDKProtocol VdaSdk_LogSearch ret:" + retVal); return(retVal); }
public bool LogSearch(LogSearchParam param) { m_param = param; return(Framework.Container.Instance.IVXProtocol.LogSearch(m_param)); }
public void GetLogInfoList(LogSearchParam parm) { getLogListTh = new System.Threading.Thread(GetLogInfoFunc); getLogListTh.Start((object)parm); }
/// <summary> /// 获取日志列表 /// </summary> /// <param name="entity">日志搜索实体</param> /// <returns>PageDataModel<LogEntity></returns> public async Task <BasePagedListModel <LogEntity> > GetListAsync(LogSearchParam param) { BasePagedListModel <LogEntity> list = new BasePagedListModel <LogEntity>(); try { #region 条件与排序 StringBuilder condition = new StringBuilder("1=1"); if (param.Keyword.IsNotNullOrEmpty()) { condition.AppendFormat(" AND L_DATA like '%{0}%'", param.Keyword.FilterSql()); } // 过滤搜索范围 if (param.Range != "all") { DateTime today = DateTime.Now; switch (param.Range) { case "today": condition.AppendFormat(" AND L_TIME>='{0}'", today.ToString("yyyy-MM-dd")); break; case "last3days": condition.AppendFormat(" AND L_TIME>='{0}'", today.AddDays(-3).ToString("yyyy-MM-dd")); break; case "last7days": condition.AppendFormat(" AND L_TIME>='{0}'", today.AddDays(-7).ToString("yyyy-MM-dd")); break; case "lastmonth": condition.AppendFormat(" AND L_TIME>='{0}'", today.AddMonths(-1).ToString("yyyy-MM-dd")); break; case "lastyear": condition.AppendFormat(" AND L_TIME>='{0}'", today.AddYears(-1).ToString("yyyy-MM-dd")); break; } } #endregion PageCriteriaModel criteria = new PageCriteriaModel(); criteria.Condition = condition.ToString(); criteria.PageIndex = param.PageIndex; criteria.Fields = "*"; criteria.PageSize = param.PageSize; criteria.TableName = "S_LOG"; criteria.PrimaryKey = "L_ID"; if (param.SortName.IsNotNullOrEmpty() && param.SortOrder.IsNotNullOrEmpty()) { criteria.Sort = $"{param.SortName.FilterSql()} {param.SortOrder.FilterSql()}"; } list = await pageListRepository.GetPageDataAsync <LogEntity>(connectionProvider, criteria); } catch (ArgumentNullException ex) { logger.LogError("调用方法GetListAsync(LogSearchParam param)发生ArgumentNullException,异常信息:{0}", ex); } catch (SqlException ex) { logger.LogError("调用方法GetListAsync(LogSearchParam param)发生SqlException,异常信息:{0}", ex); } catch (Exception ex) { logger.LogError("调用方法GetListAsync(LogSearchParam param)发生Exception,异常信息:{0}", ex); } return(list); }