#region ------获取实验桩基数据信息------
/// <summary>
/// 获取实验桩基数据信息
/// </summary>
/// <param name="_StrCompactpid">项目ID</param>
/// <param name="_StrPileid">桩号</param>
/// <param name="CurPageIndex">当前页</param>
/// <param name="PageCount">总页数</param>
/// <param name="DataCount">数据总数</param>
/// <param name="PageSize">每页显示数</param>
/// <returns></returns>
public static DataTable GetZjData(string _StrCompactpid, string _StrPileid, int CurPageIndex, ref int PageCount, ref int DataCount, ref int PageSize)
{
try
{
string StrUrl = ConfigurationManager.AppSettings["DjProJectPileUrl"];//getCreditFinallAccount http://116.26.134.7:8082/sospweb/com/zr/pileCRating/quarterPile!query_pileby_cpid.do?key=zr88230232&compactpid=4BA855FBDBDC4049B73808B109049FA4&curPage=1
string strWhere = "key=zr88230232" + "&compactpid=" + _StrCompactpid;
strWhere += _StrPileid == "" ? "" : "&pileid=" + _StrPileid;
strWhere += CurPageIndex == 0 ? "" : "&curPage=" + CurPageIndex.ToString();
string strJson = PostGetData(StrUrl, strWhere);
DataTable dt = new DataTable();
#region --解析Jason结果--
Root root = JSonUtil.Deserialize<Root>(strJson);
PageCount = root.总页数;
DataCount = root.总条数;
PageSize = root.每页条数;
foreach (Dictionary<string, string> item in root.data)
{
DataRow dr = dt.NewRow();
foreach (KeyValuePair<string, string> it in item)
{
if (!dt.Columns.Contains(it.Key))
{
var dc = new DataColumn();
dc.ColumnName = it.Key;
dt.Columns.Add(dc);
}
dr[it.Key] = it.Value;
}
dt.Rows.Add(dr);
}
#endregion ----
return dt;
}
catch (Exception ex)
{
WebHelp.WriteLog(ex.Message);
return null;
}
}
#endregion ------------
接口json转化为datatable
最新推荐文章于 2023-10-24 17:49:51 发布