/// <summary> /// 分页取指标结果集 /// </summary> /// <param name="guideLineId"></param> /// <param name="param"></param> /// <param name="filterWord"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="sortBy"></param> /// <param name="sortDirection"></param> /// <returns></returns> public async static Task <IPagedList <DataTable> > QueryGuideline(string guideLineId, Dictionary <string, object> param, string filterWord, int pageIndex, int pageSize, string sortBy, string sortDirection) { int getQueryStartTime = Environment.TickCount; int recordCount = 0; DataTable tb = new DataTable("ResultTable"); MD_GuideLine define = await GetGuidelineDefine(guideLineId); if (define != null) { string queryStr = await GetGuidelineMethod(guideLineId); List <MDQuery_GuideLineParameter> glPara = new List <MDQuery_GuideLineParameter>(); if (param != null && define.Parameters != null) { foreach (var p in param) { MD_GuideLineParameter md_pa = define.Parameters.Find(pa => pa.ParameterName == p.Key); if (md_pa != null) { glPara.Add(new MDQuery_GuideLineParameter(md_pa, p.Value)); } } } foreach (MDQuery_GuideLineParameter gp in glPara) { queryStr = MySqlQueryBuilder.RebuildGuideLineQueryString(queryStr, gp); } if (!string.IsNullOrEmpty(filterWord)) { queryStr = string.Format("select * from (\n {0} \n) where {1}", queryStr, filterWord); } try { var cot = await MysqlDBHelper.ExecuteScalar(MysqlDBHelper.queryString, CommandType.Text, string.Format("select count(*) from (\n {0} \n) as t ", queryStr)); recordCount = Convert.ToInt32(cot); } catch (Exception e) { MysqlLogWriter.WriteSystemLog("Exception :QueryGuideline310行异常,异常信息为" + e.Message, "ERROR"); } queryStr = StrUtils.BuildPagingSQL22(queryStr, pageIndex, pageSize, sortBy, sortDirection); tb = await FillResultData(queryStr, "ResultTable"); MysqlLogWriter.WriteQueryLog(queryStr, Environment.TickCount - getQueryStartTime, "2"); } var list = new List <DataTable>(); list.Add(tb); var ret = new StaticPagedList <DataTable>(list, pageIndex, pageSize, recordCount); return(ret); }
public async static Task <DataTable> QueryGuideline(string guideLineId, Dictionary <string, object> param, string filterWord) { int getQueryStartTime = Environment.TickCount; DataTable tb = new DataTable("ResultTable"); MD_GuideLine define = await GetGuidelineDefine(guideLineId); if (define != null) { string queryStr = await GetGuidelineMethod(guideLineId); List <MDQuery_GuideLineParameter> glPara = new List <MDQuery_GuideLineParameter>(); if (param != null && define.Parameters != null) { foreach (var p in param) { MD_GuideLineParameter md_pa = define.Parameters.Find(pa => pa.ParameterName == p.Key); if (md_pa != null) { glPara.Add(new MDQuery_GuideLineParameter(md_pa, p.Value)); } } } foreach (MDQuery_GuideLineParameter gp in glPara) { queryStr = MySqlQueryBuilder.RebuildGuideLineQueryString(queryStr, gp); } if (!string.IsNullOrEmpty(filterWord)) { queryStr = string.Format("select * from (\n {0} \n) where {1}", queryStr, filterWord); } tb = await FillResultData(queryStr, "ResultTable"); MysqlLogWriter.WriteQueryLog(queryStr, Environment.TickCount - getQueryStartTime, "2"); } return(tb); }