public static string GetEnvParamSpot(string sourcetype, TreeNode treenode, ref List <TreeNode> SourceMonitor)//按组织获取环境量资源 { //string[] code = {"sensor_158813956587359","sensor_158842351613543"}; //string Inf = Program.Service.Interface.getResourceByCodes(Program.Service.Token, int.Parse(ComandValueMap[sourcetype]), code);//按资源编号获取资源信息 TreeNode node_child; SourceInfo parntinfo = (SourceInfo)treenode.Tag; string indexcode = parntinfo.IndexCode; string pInBuf = "\r\n" + treenode.Text + sourcetype + "\r\n"; if (treenode.Text == "杭州市") { string aa = ""; aa += "23fearf"; } int command = int.Parse(_ComandValueMap[sourcetype]); string Info = PlatformService.getResourceByOrgCode(command, indexcode, ""); if (Info == "") { return(""); } ServiceResult sr = ServiceResult.Parse(Info); SourceInfo sourceinfo = new SourceInfo(); int count = sr.Rows.Count; for (int i = 0; i < count; i++) { node_child = new TreeNode(); sourceinfo.SourceName = node_child.Text = sr.Rows[i]["extend_resource_name"]; sourceinfo.Type = GetSourceType(sourcetype);//环境量 sourceinfo.IndexCode = sr.Rows[i]["extend_resource_code"]; SourceInfo panrtinfo = (SourceInfo)(treenode.Tag); sourceinfo.ParentIndexCode = panrtinfo.IndexCode;//用户对应组织节点索引号 treenode.Expand(); node_child.Tag = sourceinfo; treenode.Nodes.Add(node_child); if (SourceMonitor != null) { SourceMonitor.Add(node_child); } } TracePrint(sr, "获取" + sourcetype, "getResourceByOrgCode"); return(pInBuf + Info); }
public static string GetSource(TreeView treeview)//为回放、预览提供监控点资源树 { string pinbuf; if (treeview.Nodes.Count != 0) { return(""); } treeview.Nodes.Clear(); ServiceResult SourceSr = null; string sourcetype = "组织资源"; int command = int.Parse(PlatformService._ComandValueMap[sourcetype]); pinbuf = PlatformService.GetResourceByPage(command, ref SourceSr); int count = SourceSr.Rows.Count; TreeNode node_alarmtype, node_parent; SourceInfo sourceinfo = new SourceInfo(); for (int i = 0; i < count; i++)//构建监控点资源树的组织资源 { node_alarmtype = new TreeNode(); sourceinfo.SourceName = node_alarmtype.Text = SourceSr.Rows[i]["c_org_name"]; sourceinfo.sourceid = SourceSr.Rows[i]["i_id"]; sourceinfo.IndexCode = SourceSr.Rows[i]["c_index_code"]; sourceinfo.Type = GetSourceType(sourcetype); if (SourceSr.Rows[i]["i_parent_id"] == "null" || SourceSr.Rows[i]["i_parent_id"] == "c_0") { sourceinfo.parntid = ""; node_alarmtype.Tag = sourceinfo; treeview.Nodes.Add(node_alarmtype); } else { node_parent = PlatformService.CallFindNodeByName(SourceSr.Rows[i]["i_parent_id"], treeview); node_parent.Expand(); SourceInfo parntinfo = (SourceInfo)(node_parent.Tag); node_alarmtype.Tag = sourceinfo; node_parent.Nodes.Add(node_alarmtype); } } return(pinbuf); }
public static string GetUsersInfo(string sourcetype, TreeNode treenode, ref List <TreeNode> SourceMonitor)//获取用户信息 { TreeNode node_child; SourceInfo parntinfo = (SourceInfo)treenode.Tag; string indexcode = parntinfo.IndexCode; string pInBuf = "\r\n" + treenode.Text + sourcetype + "\r\n"; string Info = PlatformService.getResourceByOrgCode(int.Parse(_ComandValueMap[sourcetype]), indexcode, ""); if (Info == "") { return(""); } ServiceResult sr = ServiceResult.Parse(Info); SourceInfo sourceinfo = new SourceInfo(); int count = sr.Rows.Count; for (int i = 0; i < count; i++) { node_child = new TreeNode(); node_child.Text = sourcetype + ":"; node_child.Text += sr.Rows[i]["c_user_name"]; node_child.Text += " "; node_child.Text += sr.Rows[i]["c_person_desc"]; sourceinfo.Type = GetSourceType(sourcetype); sourceinfo.UserLevel = sr.Rows[i]["i_level"];//用户等级 sourceinfo.SourceName = sr.Rows[i]["c_user_name"]; SourceInfo panrtinfo = (SourceInfo)(treenode.Tag); sourceinfo.ParentIndexCode = panrtinfo.IndexCode;//用户对应组织节点索引号 treenode.Expand(); node_child.Tag = sourceinfo; treenode.Nodes.Add(node_child); if (SourceMonitor != null) { SourceMonitor.Add(node_child); } } TracePrint(sr, "获取" + sourcetype, "getResourceByOrgCode"); return(pInBuf + Info); }
public static TreeNode FindTreeNode(string name, TreeNode tnParent)//根据parent_id查找父节点 { if (tnParent == null) { return(null); } SourceInfo sourceinfo = (SourceInfo)(tnParent.Tag); if (sourceinfo.sourceid == name) { return(tnParent); } TreeNode tnRet = null; foreach (TreeNode tn in tnParent.Nodes) { tnRet = FindTreeNode(name, tn); if (tnRet != null) { break; } } return(tnRet); }