public List <OBD> QueryOBD(string TEID, DateTime StartTime, DateTime EndTime, int Top) { int nStartCode = StartTime.ToPartCode(); int nEndCode = EndTime.ToPartCode(); int nTable = SqlTemplate.FindTableMod(TEID); Dictionary <string, object> dicPars = new Dictionary <string, object>(); dicPars.Add(SqlTemplate.TEIDKey, TEID); string sqlQuery = string.Format(SqlTemplate.QueryOBD, nTable, nStartCode, nEndCode, Top); DataTable dtRows = null; using (var con = SqlHelper.GetConnection(SqlConnectString)) { dtRows = SqlHelper.ExecuteDataset(con, sqlQuery, dicPars); } List <OBD> list = new List <OBD>(); if (dtRows != null) { foreach (DataRow drItem in dtRows.Rows) { OBD obd = new OBD { ID = Convert.ToInt32(drItem[SqlTemplate.RKeyID]), GetTime = Convert.ToDateTime(drItem[SqlTemplate.RKeyGetTime]), InputTime = Convert.ToDateTime(drItem[SqlTemplate.RKeyInputTime]), Speed = Convert.ToInt32(drItem[SqlTemplate.RKeySpeed]), Rotate = Convert.ToInt32(drItem[SqlTemplate.RKeyRotate]), Restrictor = Convert.ToInt32(drItem[SqlTemplate.RkeyRestrictor]), WaterT = Convert.ToInt32(drItem[SqlTemplate.RKeyWaterT]), OilT = Convert.ToInt32(drItem[SqlTemplate.RKeyOilT]), OilPressure = Convert.ToInt32(drItem[SqlTemplate.RKeyOilPressure]), OilRemain = Convert.ToInt32(drItem[SqlTemplate.RKeyOilRemain]), TEID = drItem[SqlTemplate.RKeyTEID].ToString(), PartitionCode = Convert.ToInt32(drItem[SqlTemplate.RKeyPartitionCode]) }; list.Add(obd); } } return(list); }