using BLL; using FastReport.Editor; using Newtonsoft.Json.Linq; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using System; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.IO; using System.Linq; using System.Runtime.Serialization; namespace FineUIPro.Web.HJGL.JoinMarking { public partial class JointShow : PageBase { #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.InitTreeMenu();//加载树 } } #endregion /// /// 查询 /// /// /// protected void Tree_TextChanged(object sender, EventArgs e) { this.InitTreeMenu(); } #region 加载树装置-单位-工作区 /// /// 加载树 /// private void InitTreeMenu() { this.tvControlItem.Nodes.Clear(); TreeNode rootNode = new TreeNode(); rootNode.Text = "管线列表"; rootNode.NodeID = "0"; rootNode.Expanded = true; this.tvControlItem.Nodes.Add(rootNode); var iso = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x; if (!string.IsNullOrEmpty(this.txtIsono.Text)) { iso = iso.Where(e => e.PipelineCode.Contains(this.txtIsono.Text.Trim())); } iso = iso.OrderBy(x => x.PipelineCode); if (iso.Count() > 0) { foreach (var q in iso) { TreeNode newNode = new TreeNode(); newNode.NodeID = q.PipelineId; newNode.Text = q.PipelineCode; newNode.ToolTip = "管线"; newNode.EnableClickEvent = true; newNode.EnableExpandEvent = true; rootNode.Nodes.Add(newNode); TreeNode newNodeTemp = new TreeNode(); newNodeTemp.Text = "加载中..."; newNodeTemp.NodeID = Guid.NewGuid().ToString(); newNode.Nodes.Add(newNodeTemp); } } } #endregion #region 绑定树节点 /// /// 绑定树节点 /// /// #endregion #region 树展开事件 /// /// 树展开事件 /// /// /// protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { e.Node.Nodes.Clear(); if (e.Node.ToolTip == "管线") { e.Node.Nodes.Clear(); var attach = AttachFileService.GetAttachFile(e.Node.NodeID, BLL.Const.HJGL_PipelineMenuId); if (attach != null) { var source = attach.AttachSource; var array = JArray.Parse(source); for (int i = 0; i < array.Count; i++) { JObject item = array[i] as JObject; TreeNode newNode = new TreeNode(); newNode.Text = item.Value("name"); newNode.NodeID = item.Value("id"); newNode.ToolTip = newNode.Text; newNode.NavigateUrl = "PDFShow.aspx?ISO_ID=" + e.Node.NodeID + "&FileId=" + newNode.NodeID + "&pdfurl=" + item.Value("folder") + item.Value("savedName"); newNode.Target = "mainframe"; e.Node.Nodes.Add(newNode); } } } } #endregion #region 点击TreeView /// /// 点击TreeView /// /// /// protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e) { } #endregion } }