HJGL_DS/HJGL_DS/FineUIPro.Web/HJGL/JoinMarking/JointShow.aspx.cs

171 lines
4.6 KiB
C#

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
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.InitTreeMenu();//加载树
}
}
#endregion
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Tree_TextChanged(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#region --
/// <summary>
/// 加载树
/// </summary>
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_PW_IsoInfo where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (!string.IsNullOrEmpty(this.txtIsono.Text))
{
iso = iso.Where(e => e.ISO_IsoNo.Contains(this.txtIsono.Text.Trim()));
}
iso = iso.OrderBy(x => x.ISO_IsoNo);
if (iso.Count() > 0)
{
foreach (var q in iso)
{
TreeNode newNode = new TreeNode();
newNode.NodeID = q.ISO_ID;
newNode.Text = q.ISO_IsoNo;
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
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
#endregion
#region
/// <summary>
/// 树展开事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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_PipelineManageMenuId);
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<string>("name");
newNode.NodeID = item.Value<string>("id");
newNode.ToolTip = newNode.Text;
newNode.NavigateUrl = "PDFShow.aspx?ISO_ID=" + e.Node.NodeID + "&FileId=" + newNode.NodeID + "&pdfurl=" + item.Value<string>("folder") + item.Value<string>("savedName");
newNode.Target = "mainframe";
e.Node.Nodes.Add(newNode);
}
}
}
}
#endregion
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
}
#endregion
}
}