/// <summary> /// 返回指定工区井信息 /// </summary> /// <param name="rid">工区id</param> /// <returns>二维List,List[0]:wellnamelist;List[1]:wellidlist</returns> private List <List <String> > GetWellListByRegionId(String rid) { List <String> wellnameList = new List <string>(); List <String> wellidList = new List <string>(); try { DataTable dt = new DataTable(); dt = Pusher._pusher.GetAllWellsByRegionId(rid, out JsonString); foreach (DataRow dr in dt.Rows) { WellnameList.Add(dr[0].ToString()); WellidList.Add(dr[1].ToString()); } List <List <String> > wellinfo = new List <List <string> >(); Wellinfo.Add(WellnameList); Wellinfo.Add(WellidList); return(Wellinfo); } catch (Exception ex) { Debug.WriteLine(ex.Message + "\r\t <====== RemoteWell.cs-->GetWellListByRegionId() ,Error!======>"); return(null); } }
private void treeView_remoteWell_AfterSelect(object sender, TreeViewEventArgs e) { try { if (treeView_remoteWell.SelectedNode != null) { String strSelectedid = e.Node.ToolTipText; String strSelectedname = e.Node.Text; switch (e.Node.Level)//TreeView层数 { //通过工区节点 获取工区包含的井节点信息 case 0: Wellinfo.Clear(); WellidList.Clear(); WellnameList.Clear(); RegionId = strSelectedid; RegionName = strSelectedname; Wellinfo = GetWellListByRegionId(RegionId); for (int i = 0; i < WellnameList.Count; i++) { if (!getChildNodeList(e.Node).Contains(WellnameList[i])) { TreeNode wellnode = new TreeNode(WellnameList[i]); wellnode.ToolTipText = WellidList[i]; e.Node.Nodes.Add(wellnode); } } SelectedNodeLevel = 0; break; //通过井节点 获取井包含的井次信息 case 1: Loginfo.Clear(); LogidList.Clear(); LognameList.Clear(); WellId = strSelectedid; WellName = strSelectedname; Loginfo = GetLogListByWellId(WellId); for (int i = 0; i < LognameList.Count; i++) { if (!getChildNodeList(e.Node).Contains(LognameList[i])) { TreeNode lognode = new TreeNode(LognameList[i]); lognode.ToolTipText = LogidList[i]; e.Node.Nodes.Add(lognode); } } SelectedNodeLevel = 1; break; //选择井次 case 2: LogName = e.Node.Text; LogId = e.Node.ToolTipText; SelectedNodeLevel = 2; break; } initialNodeMap(); } } catch (Exception ex) { Debug.WriteLine(ex.Message + "\r\t <====== RemoteWell.cs-->treeView_remoteWell_AfterSelect() ,Error!======>"); } }