/// <summary> /// 通过井ID获取井次信息 /// </summary> /// <param name="regionid"></param> /// <param name="jstring"></param> /// <returns></returns> public DataTable GetAllLogsByWellId(String wellid, out String jstring) { try { InitHashTable(); colName.Clear(); colData.Clear(); ht.Add("wellid", wellid); strJsonSend = JsonHepler.HashtableToJson(ht, 0); jstring = _realdbws.GetAllLogsByWellId(strJsonSend); Hashtable tempHT = (Hashtable)JsonConvert.DeserializeObject(jstring, typeof(Hashtable)); //获取列名 colName = JsonHepler.getJsonCol(tempHT, "title"); //获取数据 colData = JsonHepler.getJsonData(tempHT, "data", colName.Count); return(JsonHepler.List2DataTable(colData, colName)); } catch (System.Exception ex) { Debug.WriteLine(ex.Message + "\r\t==========" + "pusher.GetAllLogsByWellId()"); jstring = String.Empty; return(null); } }
/// <summary> /// 获取仪器信息 /// </summary> /// <param name="jstring">输出JsonString</param> /// <returns>Jstring转换成DataTable</returns> public DataTable GetAllInstName(out String jstring) { try { colName.Clear(); colData.Clear(); strJsonSend = JsonHepler.HashtableToJson(ht, 0); jstring = _realdbws.GetAllInstName(strJsonSend); Hashtable tempHT = (Hashtable)JsonConvert.DeserializeObject(jstring, typeof(Hashtable)); //获取列名 colName = JsonHepler.getJsonCol(tempHT, "title"); //获取数据 colData = JsonHepler.getJsonData(tempHT, "data", colName.Count); return(JsonHepler.List2DataTable(colData, colName)); } catch (System.Exception ex) { Debug.WriteLine(ex.Message + "\r\t==========" + "pusher.GetAllInstName()"); jstring = ""; DataTable dt = new DataTable(); return(dt); } }
/// <summary> /// 写曲线 /// </summary> /// <returns>写的记录条数</returns> public int WriteCurveData(String title, String regionName, out String jstring) { int sum = 0; try { InitHashTable(false, title, regionName); colName.Clear(); colData.Clear(); strJsonSend = JsonHepler.HashtableToJson(ht, 0); jstring = _realdbws.WriteCurveData(strJsonSend); Hashtable tempHT = (Hashtable)JsonConvert.DeserializeObject(jstring, typeof(Hashtable)); //获取列名 colName = JsonHepler.getJsonCol(tempHT, "title"); //获取数据 colData = JsonHepler.getJsonData(tempHT, "data", colName.Count); //return JsonHepler.List2DataTable(colData, colName); } catch (System.Exception ex) { Debug.WriteLine(ex.Message + "\r\t==========" + "pusher.GetAllLogsByWellId()"); jstring = String.Empty; //return null; } return(sum); }
/// <summary> /// 连接测试 /// </summary> /// <returns>是否连接异常</returns> public bool ConnectTest() { try { String jstring; colName.Clear(); colData.Clear(); InitHashTable(); strJsonSend = JsonHepler.HashtableToJson(ht, 0); jstring = _realdbws.GetAllRegions(strJsonSend); Hashtable tempHT = (Hashtable)JsonConvert.DeserializeObject(jstring, typeof(Hashtable)); //获取列名 colName = JsonHepler.getJsonCol(tempHT, "title"); //获取数据 colData = JsonHepler.getJsonData(tempHT, "data", colName.Count); JsonHepler.List2DataTable(colData, colName); return(true); } catch (System.Exception ex) { Debug.WriteLine(ex.Message + "\r\t==========" + "pusher.ConnectTest()"); return(false); } }