474 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			474 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using Newtonsoft.Json.Linq;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								using AspNet = System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.HSSE.Hazard
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class ShowWBS : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public string WorkAreaId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["WorkAreaId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["WorkAreaId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 被选择项列表
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public List<string> SelectedList
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (List<string>)ViewState["SelectedList"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["SelectedList"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 未被选择项列表
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public List<string> NoSelectedList
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (List<string>)ViewState["NoSelectedList"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["NoSelectedList"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.SelectedList = new List<string>();
							 | 
						|||
| 
								 | 
							
								                this.NoSelectedList = new List<string>();
							 | 
						|||
| 
								 | 
							
								                WorkAreaId = Request.Params["WorkAreaId"];
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(WorkAreaId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    WorkAreaId = "";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                InitTreeMenu();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载树
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="cnProfessionalId"></param>
							 | 
						|||
| 
								 | 
							
								        private void InitTreeMenu()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.Nodes.Clear();
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.ShowHeader = false;
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.ShowBorder = false;
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.EnableIcons = true;
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.AutoScroll = true;
							 | 
						|||
| 
								 | 
							
								            this.tvControlItem.EnableSingleClickExpand = true;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            var unitWorks = from x in Funs.DB.WBS_UnitWork where (WorkAreaId == "" || x.UnitWorkId == WorkAreaId) && x.ProjectId == this.CurrUser.LoginProjectId orderby x.UnitWorkCode select x;
							 | 
						|||
| 
								 | 
							
								            if (unitWorks.Count() > 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                foreach (var q in unitWorks)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    TreeNode rootNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                    rootNode.Text = q.UnitWorkName;
							 | 
						|||
| 
								 | 
							
								                    rootNode.NodeID = q.UnitWorkId;
							 | 
						|||
| 
								 | 
							
								                    rootNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                    rootNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                    rootNode.CommandName = "UnitWork";
							 | 
						|||
| 
								 | 
							
								                    this.tvControlItem.Nodes.Add(rootNode);
							 | 
						|||
| 
								 | 
							
								                    TreeNode emptyNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                    emptyNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                    emptyNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                    rootNode.Nodes.Add(emptyNode);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region  展开树
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 展开树
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void trWBS_NodeExpand(object sender, TreeNodeEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            e.Node.Nodes.Clear();
							 | 
						|||
| 
								 | 
							
								            if (e.Node.CommandName == "UnitWork")   //展开工程类型
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                TreeNode newNode1 = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                newNode1.Text = "建筑工程";
							 | 
						|||
| 
								 | 
							
								                newNode1.NodeID = e.NodeID + "|" + "1";
							 | 
						|||
| 
								 | 
							
								                newNode1.CommandName = "ProjectType";
							 | 
						|||
| 
								 | 
							
								                newNode1.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                newNode1.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                e.Node.Nodes.Add(newNode1);
							 | 
						|||
| 
								 | 
							
								                TreeNode tempNode1 = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                tempNode1.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                tempNode1.Text = "";
							 | 
						|||
| 
								 | 
							
								                tempNode1.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                tempNode1.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                newNode1.Nodes.Add(tempNode1);
							 | 
						|||
| 
								 | 
							
								                TreeNode newNode2 = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                newNode2.Text = "安装工程";
							 | 
						|||
| 
								 | 
							
								                newNode2.NodeID = e.NodeID + "|" + "2";
							 | 
						|||
| 
								 | 
							
								                newNode2.CommandName = "ProjectType";
							 | 
						|||
| 
								 | 
							
								                newNode2.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                newNode2.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                e.Node.Nodes.Add(newNode2);
							 | 
						|||
| 
								 | 
							
								                TreeNode tempNode2 = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                tempNode2.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                tempNode2.Text = "";
							 | 
						|||
| 
								 | 
							
								                tempNode2.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                tempNode2.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                newNode2.Nodes.Add(tempNode2);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (e.Node.CommandName == "ProjectType")   //展开工程类型
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (e.NodeID.Split('|')[1] == "1")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId == Const.CNProfessionalCVId orderby x.SortIndex select x).ToList();
							 | 
						|||
| 
								 | 
							
								                    foreach (var c in cNProfessional)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        TreeNode newCNProfessionalNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.Text = c.ProfessionalName;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.NodeID = e.NodeID.Split('|')[0] + "|" + c.CNProfessionalId;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.CommandName = "CNProfessional";
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        e.Node.Nodes.Add(newCNProfessionalNode);
							 | 
						|||
| 
								 | 
							
								                        TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var cNProfessional = (from x in BLL.Funs.DB.Base_CNProfessional where x.CNProfessionalId != Const.CNProfessionalConstructId && x.CNProfessionalId != Const.CNProfessionalCVId orderby x.SortIndex select x).ToList();
							 | 
						|||
| 
								 | 
							
								                    foreach (var c in cNProfessional)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        TreeNode newCNProfessionalNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.Text = c.ProfessionalName;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.NodeID = e.NodeID.Split('|')[0] + "|" + c.CNProfessionalId;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.CommandName = "CNProfessional";
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        e.Node.Nodes.Add(newCNProfessionalNode);
							 | 
						|||
| 
								 | 
							
								                        TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newCNProfessionalNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (e.Node.CommandName == "CNProfessional")   //展开专业
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string unitWorkId = e.Node.ParentNode.NodeID;
							 | 
						|||
| 
								 | 
							
								                if (string.IsNullOrEmpty(unitWorkId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    unitWorkId = e.Node.ParentNode.ParentNode.NodeID;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                Model.WBS_UnitWork unitWork1 = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(unitWorkId);
							 | 
						|||
| 
								 | 
							
								                if (unitWork1 == null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    unitWorkId = e.Node.ParentNode.ParentNode.NodeID;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                string cNProfessionalId = e.NodeID;
							 | 
						|||
| 
								 | 
							
								                if (e.NodeID.Contains("|"))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    cNProfessionalId = e.NodeID.Split('|')[1];
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (cNProfessionalId == BLL.Const.CNProfessionalConstructId)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var divisionsCV = (from x in BLL.Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                       where x.CNProfessionalId == BLL.Const.CNProfessionalCVId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                       orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                       select x).ToList();
							 | 
						|||
| 
								 | 
							
								                    if (divisionsCV.Count > 0)   //建筑工程下存在土建内容
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        TreeNode newNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        newNode.Text = "土建";
							 | 
						|||
| 
								 | 
							
								                        newNode.NodeID = BLL.Const.CNProfessionalCVId;
							 | 
						|||
| 
								 | 
							
								                        newNode.CommandName = "CNProfessional";
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        e.Node.Nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								                        TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        tempNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                         where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                         orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                         select x).ToList();
							 | 
						|||
| 
								 | 
							
								                        foreach (var q in divisions)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            TreeNode newNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                            newNode.Text = q.DivisionName;
							 | 
						|||
| 
								 | 
							
								                            newNode.NodeID = q.DivisionProjectId;
							 | 
						|||
| 
								 | 
							
								                            newNode.CommandName = "DivisionProject";
							 | 
						|||
| 
								 | 
							
								                            newNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                            newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                            newNode.EnableCheckEvent = true;
							 | 
						|||
| 
								 | 
							
								                            e.Node.Nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								                            if (q.IsSelected == true)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                newNode.Checked = true;
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                            var list = (from x in Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                        where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId
							 | 
						|||
| 
								 | 
							
								                                        orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                        select x).ToList();
							 | 
						|||
| 
								 | 
							
								                            if (list.Count > 0)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                                tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                                tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                                newNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                     where x.CNProfessionalId == cNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                     orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                     select x).ToList();
							 | 
						|||
| 
								 | 
							
								                    foreach (var q in divisions)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        TreeNode newNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        newNode.Text = q.DivisionName;
							 | 
						|||
| 
								 | 
							
								                        newNode.NodeID = q.DivisionProjectId;
							 | 
						|||
| 
								 | 
							
								                        newNode.CommandName = "DivisionProject";
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableCheckBox = true;
							 | 
						|||
| 
								 | 
							
								                        newNode.EnableCheckEvent = true;
							 | 
						|||
| 
								 | 
							
								                        e.Node.Nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								                        if (q.IsSelected == true)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            newNode.Checked = true;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        var list = (from x in Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                    where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                    orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                    select x).ToList();
							 | 
						|||
| 
								 | 
							
								                        if (list.Count > 0)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                            tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                            tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                            newNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (e.Node.CommandName == "DivisionProject")   //展开分部节点
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var childDivisions = (from x in BLL.Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                      where x.SuperDivisionId == e.Node.NodeID && x.ProjectId == this.CurrUser.LoginProjectId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                      orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                      select x).ToList();
							 | 
						|||
| 
								 | 
							
								                foreach (var q in childDivisions)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    TreeNode newNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                    newNode.Text = q.DivisionName;
							 | 
						|||
| 
								 | 
							
								                    newNode.NodeID = q.DivisionProjectId;
							 | 
						|||
| 
								 | 
							
								                    newNode.CommandName = "DivisionProject";
							 | 
						|||
| 
								 | 
							
								                    newNode.EnableExpandEvent = true;
							 | 
						|||
| 
								 | 
							
								                    newNode.EnableClickEvent = true;
							 | 
						|||
| 
								 | 
							
								                    newNode.EnableCheckBox = true;
							 | 
						|||
| 
								 | 
							
								                    newNode.EnableCheckEvent = true;
							 | 
						|||
| 
								 | 
							
								                    e.Node.Nodes.Add(newNode);
							 | 
						|||
| 
								 | 
							
								                    if (q.IsSelected == true)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        newNode.Checked = true;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    var list = (from x in Funs.DB.WBS_DivisionProject
							 | 
						|||
| 
								 | 
							
								                                where x.SuperDivisionId == q.DivisionProjectId && x.ProjectId == this.CurrUser.LoginProjectId && x.IsSelected == true
							 | 
						|||
| 
								 | 
							
								                                orderby x.SortIndex
							 | 
						|||
| 
								 | 
							
								                                select x).ToList();
							 | 
						|||
| 
								 | 
							
								                    if (list.Count > 0)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        TreeNode tempNode = new TreeNode();
							 | 
						|||
| 
								 | 
							
								                        tempNode.NodeID = "";
							 | 
						|||
| 
								 | 
							
								                        tempNode.Text = "";
							 | 
						|||
| 
								 | 
							
								                        newNode.Nodes.Add(tempNode);
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 点击树节点
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 点击树节点
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.hdDivisionProjectId.Text = this.tvControlItem.SelectedNode.NodeID;
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 数据绑定
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string strSql = @"SELECT V.BreakdownProjectId, 
							 | 
						|||
| 
								 | 
							
								                                     V.ProjectId, 
							 | 
						|||
| 
								 | 
							
								                                     V.BreakdownCode, 
							 | 
						|||
| 
								 | 
							
								                                     V.BreakdownName, 
							 | 
						|||
| 
								 | 
							
								                                     V.DivisionProjectId, 
							 | 
						|||
| 
								 | 
							
								                                     V.Basis, 
							 | 
						|||
| 
								 | 
							
								                                     V.CheckPoints, 
							 | 
						|||
| 
								 | 
							
								                                     V.RecordAndCode, 
							 | 
						|||
| 
								 | 
							
								                                     V.Class, 
							 | 
						|||
| 
								 | 
							
								                                     V.SortIndex, 
							 | 
						|||
| 
								 | 
							
								                                     V.Remark, 
							 | 
						|||
| 
								 | 
							
								                                     V.AttachUrl, 
							 | 
						|||
| 
								 | 
							
								                                     V.IsAcceptance, 
							 | 
						|||
| 
								 | 
							
								                                     V.FenBao, 
							 | 
						|||
| 
								 | 
							
								                                     V.WuHuan, 
							 | 
						|||
| 
								 | 
							
								                                     V.JianLi, 
							 | 
						|||
| 
								 | 
							
								                                     V.YeZhu, 
							 | 
						|||
| 
								 | 
							
								                                     V.IsSelected"
							 | 
						|||
| 
								 | 
							
								                            + @" FROM View_WBS_BreakdownProject AS V "
							 | 
						|||
| 
								 | 
							
								                            + @" WHERE V.ProjectId=@ProjectId AND V.DivisionProjectId=@divisionProjectId";
							 | 
						|||
| 
								 | 
							
								            List<SqlParameter> listStr = new List<SqlParameter>();
							 | 
						|||
| 
								 | 
							
								            listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
							 | 
						|||
| 
								 | 
							
								            listStr.Add(new SqlParameter("@divisionProjectId", this.hdDivisionProjectId.Text.Trim()));
							 | 
						|||
| 
								 | 
							
								            SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								            DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
							 | 
						|||
| 
								 | 
							
								            Grid1.RecordCount = tb.Rows.Count;
							 | 
						|||
| 
								 | 
							
								            var table = this.GetPagedDataTable(Grid1, tb);
							 | 
						|||
| 
								 | 
							
								            Grid1.DataSource = table;
							 | 
						|||
| 
								 | 
							
								            Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 分页
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 分页
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Grid1.PageIndex = e.NewPageIndex;
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 下拉框分页
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 排序
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Grid1.SortDirection = e.SortDirection;
							 | 
						|||
| 
								 | 
							
								            Grid1.SortField = e.SortField;
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 确定
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 确定按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSure_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string ids = string.Empty;
							 | 
						|||
| 
								 | 
							
								            SelectedList.Clear();
							 | 
						|||
| 
								 | 
							
								            foreach (JObject mergedRow in Grid1.GetMergedData())
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                JObject values = mergedRow.Value<JObject>("values");
							 | 
						|||
| 
								 | 
							
								                int i = mergedRow.Value<int>("index");
							 | 
						|||
| 
								 | 
							
								                AspNet.CheckBox ckb = (AspNet.CheckBox)(this.Grid1.Rows[i].FindControl("cbSelect"));
							 | 
						|||
| 
								 | 
							
								                if (ckb.Checked)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    SelectedList.Add(this.Grid1.Rows[i].RowID);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (SelectedList.Count == 0)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("没有选中任何项!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (SelectedList.Count > 1)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Alert.ShowInTop("只能选中一项!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                return;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            foreach (var item in SelectedList)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ids += item + ",";
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(ids))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ids = ids.Substring(0, ids.LastIndexOf(","));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            //string scripts = String.Format("F.getActiveWindow().window.reloadGrid('{0}');", ids);
							 | 
						|||
| 
								 | 
							
								            //PageContext.RegisterStartupScript(scripts + ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(ids)
							 | 
						|||
| 
								 | 
							
								                   + ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |