1009 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			1009 lines
		
	
	
		
			53 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Linq;
 | ||
| using System.Web.UI.WebControls;
 | ||
| using System.Data;
 | ||
| using BLL;
 | ||
| using System.Data.SqlClient;
 | ||
| 
 | ||
| namespace FineUIPro.Web.CQMS.WBS
 | ||
| {
 | ||
|     public partial class ProjectControlPointFile : PageBase
 | ||
|     {
 | ||
|         /// <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>();
 | ||
|                 GetButtonPower();
 | ||
|                 InitTreeMenu();
 | ||
|                 this.Grid1.Columns[2].Hidden = false;
 | ||
|                 this.Grid1.Columns[3].Hidden = true;
 | ||
|                 this.Grid1.Columns[4].Hidden = true;
 | ||
|                 this.Grid1.Columns[5].Hidden = false;
 | ||
|                 this.Grid1.Columns[7].Hidden = false;
 | ||
|                 this.Grid1.Columns[8].Hidden = false;
 | ||
|                 this.Grid1.Columns[9].Hidden = false;
 | ||
|                 this.Grid1.Columns[10].Hidden = false;
 | ||
|                 this.Grid1.Columns[11].Hidden = false;
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  加载树
 | ||
|         /// <summary>
 | ||
|         /// 加载树
 | ||
|         /// </summary>
 | ||
|         private void InitTreeMenu()
 | ||
|         {
 | ||
|             this.trWBS.Nodes.Clear();
 | ||
|             this.trWBS.ShowBorder = false;
 | ||
|             this.trWBS.ShowHeader = false;
 | ||
|             this.trWBS.EnableIcons = true;
 | ||
|             this.trWBS.AutoScroll = true;
 | ||
|             this.trWBS.EnableSingleClickExpand = true;
 | ||
|             var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId orderby x.UnitWorkCode select x;
 | ||
|             foreach (var q in unitWorks)
 | ||
|             {
 | ||
|                 TreeNode newNode = new TreeNode();
 | ||
|                 newNode.Text = q.UnitWorkName;
 | ||
|                 newNode.NodeID = q.UnitWorkId;
 | ||
|                 newNode.CommandName = "UnitWork";
 | ||
|                 newNode.EnableExpandEvent = true;
 | ||
|                 newNode.EnableClickEvent = true;
 | ||
|                 this.trWBS.Nodes.Add(newNode);
 | ||
|                 TreeNode emptyNode = new TreeNode();
 | ||
|                 emptyNode.Text = "";
 | ||
|                 emptyNode.NodeID = "";
 | ||
|                 newNode.Nodes.Add(emptyNode);
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #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];
 | ||
|                 }
 | ||
|                 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
 | ||
|                                  orderby x.SortIndex
 | ||
|                                  select x).ToList();
 | ||
|                 foreach (var q in divisions)
 | ||
|                 {
 | ||
|                     if (q.IsSelected == true)
 | ||
|                     {
 | ||
|                         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);
 | ||
| 
 | ||
|                         //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 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
 | ||
|                                       orderby x.SortIndex
 | ||
|                                       select x).ToList();
 | ||
|                 foreach (var q in childDivisions)
 | ||
|                 {if (q.IsSelected == true)
 | ||
|                     {
 | ||
|                         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);
 | ||
| 
 | ||
|                         //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);
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  树节点复选框勾选事件
 | ||
|         /// <summary>
 | ||
|         /// 树节点复选框勾选事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void trWBS_NodeCheck(object sender, FineUIPro.TreeCheckEventArgs e)
 | ||
|         {
 | ||
|             if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId, BLL.Const.BtnSave))
 | ||
|             {
 | ||
|                 Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(e.NodeID);
 | ||
|                 divisionProject.IsSelected = e.Checked;
 | ||
|                 BLL.DivisionProjectService.UpdateDivisionProject(divisionProject);
 | ||
|                 this.UpdateParentDivision(divisionProject.SuperDivisionId, e.Checked);
 | ||
|                 BindGrid();
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("您没有保存(勾选)这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 更新分部的选择状态
 | ||
|         /// </summary>
 | ||
|         /// <param name="superDivisionId"></param>
 | ||
|         private void UpdateParentDivision(string superDivisionId, bool b)
 | ||
|         {
 | ||
|             Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(superDivisionId);
 | ||
|             if (superDivisionProject != null)
 | ||
|             {
 | ||
|                 if (string.IsNullOrEmpty(superDivisionProject.SuperDivisionId))
 | ||
|                 {
 | ||
|                     //    if (!string.IsNullOrEmpty(superDivisionProject.CNProfessionalId))
 | ||
|                     //{
 | ||
|                     superDivisionProject.IsSelected = b;
 | ||
|                     BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     superDivisionProject.IsSelected = b;
 | ||
|                     BLL.DivisionProjectService.UpdateDivisionProject(superDivisionProject);
 | ||
|                     this.UpdateParentDivision(superDivisionProject.SuperDivisionId, b);
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  Tree点击事件
 | ||
|         /// <summary>
 | ||
|         /// Tree点击事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
 | ||
|         {
 | ||
|             for (int i = 0; i < this.Grid1.Rows.Count; i++)
 | ||
|             {
 | ||
|                 if (this.Grid1.SelectedRowIDArray.Contains(this.Grid1.Rows[i].RowID))
 | ||
|                 {
 | ||
|                     SelectedList.Add(this.Grid1.Rows[i].RowID);
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     NoSelectedList.Add(this.Grid1.Rows[i].RowID);
 | ||
|                 }
 | ||
|             }
 | ||
|             string divisionProjectId = this.trWBS.SelectedNode.NodeID;
 | ||
|             var temp = BLL.DivisionProjectService.GetDivisionProjectById(divisionProjectId);
 | ||
|             if (temp == null)
 | ||
|             {
 | ||
|                 return;
 | ||
|             }
 | ||
|             if (temp.CNProfessionalId != null && temp.CNProfessionalId == Const.CNProfessionalConstructId)
 | ||
|             {
 | ||
|                 this.Grid1.Columns[2].Hidden = false;
 | ||
|                 this.Grid1.Columns[3].Hidden = true;
 | ||
|                 this.Grid1.Columns[4].Hidden = true;
 | ||
|                 this.Grid1.Columns[5].Hidden = false;
 | ||
|                 this.Grid1.Columns[7].Hidden = false;
 | ||
|                 this.Grid1.Columns[8].Hidden = false;
 | ||
|                 this.Grid1.Columns[9].Hidden = false;
 | ||
|                 this.Grid1.Columns[10].Hidden = false;
 | ||
|                 this.Grid1.Columns[11].Hidden = false;
 | ||
|                 this.Grid1.Columns[12].Hidden = false;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 this.Grid1.Columns[2].Hidden = false;
 | ||
|                 this.Grid1.Columns[3].Hidden = false;
 | ||
|                 this.Grid1.Columns[4].Hidden = false;
 | ||
|                 this.Grid1.Columns[5].Hidden = true;
 | ||
|                 this.Grid1.Columns[7].Hidden = true;
 | ||
|                 this.Grid1.Columns[8].Hidden = true;
 | ||
|                 this.Grid1.Columns[9].Hidden = true;
 | ||
|                 this.Grid1.Columns[10].Hidden = true;
 | ||
|                 this.Grid1.Columns[11].Hidden = true;
 | ||
|                 this.Grid1.Columns[12].Hidden = true;
 | ||
|             }
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  修改关闭窗口
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("修改成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             GetSelectTreeNode();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  增加关闭窗口
 | ||
|         /// <summary>
 | ||
|         /// 增加关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window2_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("增加成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             GetSelectTreeNode();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  关闭窗口
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window3_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 根据选择节点获取单位工程Id
 | ||
|         /// </summary>
 | ||
|         /// <param name="node"></param>
 | ||
|         private string GetUnitWorkId(TreeNode node)
 | ||
|         {
 | ||
|             string id = string.Empty;
 | ||
|             TreeNode parentNode = node.ParentNode;
 | ||
|             if (parentNode != null)
 | ||
|             {
 | ||
|                 Model.WBS_UnitWork i = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(parentNode.NodeID);
 | ||
|                 if (i != null)
 | ||
|                 {
 | ||
|                     id = i.UnitWorkId;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     id = this.GetUnitWorkId(parentNode);
 | ||
|                 }
 | ||
|             }
 | ||
|             return id;
 | ||
|         }
 | ||
| 
 | ||
|        
 | ||
|          
 | ||
| 
 | ||
|         #region 删除
 | ||
|         /// <summary>
 | ||
|         /// 删除
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnMenuDel_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | ||
|             {
 | ||
|                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
|             //var controlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.InitControlItemCode == Grid1.SelectedRowID);
 | ||
|             //if (controlItemAndCycle != null)
 | ||
|             //{
 | ||
|             //    ShowNotify("WBS定制中已使用该数据,无法删除!", MessageBoxIcon.Warning);
 | ||
|             //}
 | ||
|             //else
 | ||
|             //{
 | ||
|             BLL.BreakdownProjectService.DeleteBreakdown(Grid1.SelectedRowID);
 | ||
|             BLL.LogService.AddSys_Log(this.CurrUser, Grid1.SelectedRowID, Grid1.SelectedRowID, BLL.Const.ProjectControlPointMenuId, "删除分项");
 | ||
|             Grid1.DataBind();
 | ||
|             BindGrid();
 | ||
|             Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
 | ||
|             //}
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  绑定数据
 | ||
|         /// <summary>
 | ||
|         /// 绑定数据
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Grid1_FilterChange(object sender, EventArgs e)
 | ||
|         {
 | ||
|             BindGrid();
 | ||
|         }
 | ||
| 
 | ||
|         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
 | ||
|         {
 | ||
|             Grid1.PageIndex = e.NewPageIndex;
 | ||
|             BindGrid();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// Grid1排序
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Grid1_Sort(object sender, GridSortEventArgs e)
 | ||
|         {
 | ||
|             Grid1.SortDirection = e.SortDirection;
 | ||
|             Grid1.SortField = e.SortField;
 | ||
|             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>
 | ||
|         /// 加载Grid
 | ||
|         /// </summary>
 | ||
|         private void BindGrid()
 | ||
|         {
 | ||
|             string strSql = @"SELECT BreakdownProjectId,BreakdownCode,BreakdownName,Basis,CheckPoints,RecordAndCode,Class,FenBao,WuHuan,JianLi,YeZhu,Remark,ModelURL 
 | ||
|                        FROM WBS_BreakdownProject ";
 | ||
|             List<SqlParameter> listStr = new List<SqlParameter>();
 | ||
|             strSql += " where IsSelected = 1 and DivisionProjectId = @DivisionProjectId and ProjectId=@ProjectId";
 | ||
|             listStr.Add(new SqlParameter("@DivisionProjectId", this.trWBS.SelectedNodeID));
 | ||
|             listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
 | ||
|             SqlParameter[] parameter = listStr.ToArray();
 | ||
|             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
 | ||
| 
 | ||
|             Grid1.RecordCount = tb.Rows.Count;
 | ||
|             tb = GetFilteredTable(Grid1.FilteredData, tb);
 | ||
|             var table = this.GetPagedDataTable(Grid1, tb);
 | ||
|             Grid1.DataSource = table;
 | ||
|             Grid1.DataBind();            
 | ||
|              
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 根据所给Id定位到对应分部分项
 | ||
|         /// <summary>
 | ||
|         /// 根据所给Id定位到对应具体的工程类型、单位工程、子单位工程、分部、子分部、分项、子分项
 | ||
|         /// </summary>
 | ||
|         private void GetSelectTreeNode()
 | ||
|         {
 | ||
|             string projectType = string.Empty;
 | ||
|             string cNProfessionalId = string.Empty;
 | ||
|             string projectTypeId = string.Empty;
 | ||
|             string unitWorkId = string.Empty;
 | ||
|             List<string> list = new List<string>();
 | ||
|             Model.WBS_DivisionProject divisionProject = BLL.DivisionProjectService.GetDivisionProjectById(this.hdSelectId.Text);
 | ||
|             if (divisionProject != null)
 | ||
|             {
 | ||
|                 list = GetDivisionProjectIds(divisionProject);
 | ||
|                 list.Add(this.hdSelectId.Text);
 | ||
|                 cNProfessionalId = GetCNProfessionalId(divisionProject);
 | ||
|                 if (cNProfessionalId == Const.CNProfessionalConstructId || cNProfessionalId == Const.CNProfessionalCVId)
 | ||
|                 {
 | ||
|                     projectTypeId = Const.CNProfessionalConstructId;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     projectTypeId = "2";
 | ||
|                 }
 | ||
|                 list.Add(cNProfessionalId);
 | ||
|                 unitWorkId = divisionProject.UnitWorkId;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 cNProfessionalId = this.hdSelectId.Text;
 | ||
|                 if (cNProfessionalId == Const.CNProfessionalConstructId || cNProfessionalId == Const.CNProfessionalCVId)
 | ||
|                 {
 | ||
|                     projectTypeId = Const.CNProfessionalConstructId;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     projectTypeId = "2";
 | ||
|                 }
 | ||
|                 unitWorkId = this.hdUnitWorkId.Text;
 | ||
|             }
 | ||
| 
 | ||
|             InitTreeMenu();
 | ||
|             for (int i = 0; i < trWBS.Nodes.Count; i++)
 | ||
|             {
 | ||
|                 if (trWBS.Nodes[i].NodeID == unitWorkId)
 | ||
|                 {
 | ||
|                     trWBS.Nodes[i].Expanded = true;
 | ||
|                     trWBS.Nodes[i].Nodes.Clear();
 | ||
|                     TreeNode newNode1 = new TreeNode();
 | ||
|                     newNode1.Text = "建筑工程";
 | ||
|                     newNode1.NodeID = Const.CNProfessionalConstructId;
 | ||
|                     newNode1.CommandName = "CNProfessional";
 | ||
|                     newNode1.EnableExpandEvent = true;
 | ||
|                     newNode1.EnableClickEvent = true;
 | ||
|                     trWBS.Nodes[i].Nodes.Add(newNode1);
 | ||
|                     TreeNode newNode2 = new TreeNode();
 | ||
|                     newNode2.Text = "安装工程";
 | ||
|                     newNode2.NodeID = "2";
 | ||
|                     newNode2.CommandName = "ProjectType";
 | ||
|                     newNode2.EnableExpandEvent = true;
 | ||
|                     newNode2.EnableClickEvent = true;
 | ||
|                     trWBS.Nodes[i].Nodes.Add(newNode2);
 | ||
|                     if (!string.IsNullOrEmpty(projectTypeId))
 | ||
|                     {
 | ||
|                         for (int j = 0; j < trWBS.Nodes[i].Nodes.Count; j++)
 | ||
|                         {
 | ||
|                             if (trWBS.Nodes[i].Nodes[j].NodeID == projectTypeId)
 | ||
|                             {
 | ||
|                                 trWBS.Nodes[i].Nodes[j].Expanded = true;
 | ||
|                                 if (trWBS.Nodes[i].Nodes[j].NodeID == 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 newNode3 = new TreeNode();
 | ||
|                                         newNode3.Text = "土建";
 | ||
|                                         newNode3.NodeID = BLL.Const.CNProfessionalCVId;
 | ||
|                                         newNode3.CommandName = "CNProfessional";
 | ||
|                                         newNode3.EnableExpandEvent = true;
 | ||
|                                         newNode3.EnableClickEvent = true;
 | ||
|                                         trWBS.Nodes[i].Nodes[j].Nodes.Add(newNode3);
 | ||
|                                         newNode3.Expanded = true;
 | ||
|                                         var divisions = (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
 | ||
|                                                          orderby x.SortIndex
 | ||
|                                                          select x).ToList();
 | ||
|                                         foreach (var q in divisions)
 | ||
|                                         {
 | ||
|                                             TreeNode newNode4 = new TreeNode();
 | ||
|                                             newNode4.Text = q.DivisionName;
 | ||
|                                             newNode4.NodeID = q.DivisionProjectId;
 | ||
|                                             newNode4.CommandName = "DivisionProject";
 | ||
|                                             newNode4.EnableExpandEvent = true;
 | ||
|                                             newNode4.EnableClickEvent = true;
 | ||
|                                             if (q.IsSelected == true)
 | ||
|                                             {
 | ||
|                                                 newNode4.Checked = true;
 | ||
|                                             }
 | ||
|                                             newNode3.Nodes.Add(newNode4);
 | ||
|                                             var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                               where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
 | ||
|                                                               orderby x.SortIndex
 | ||
|                                                               select x).ToList();
 | ||
|                                             if (list.Contains(q.DivisionProjectId))
 | ||
|                                             {
 | ||
|                                                 newNode4.Expanded = true;
 | ||
|                                                 foreach (var division1 in division1s)
 | ||
|                                                 {
 | ||
|                                                     TreeNode newNode5 = new TreeNode();
 | ||
|                                                     newNode5.Text = division1.DivisionName;
 | ||
|                                                     newNode5.NodeID = division1.DivisionProjectId;
 | ||
|                                                     newNode5.CommandName = "DivisionProject";
 | ||
|                                                     newNode5.EnableExpandEvent = true;
 | ||
|                                                     newNode5.EnableClickEvent = true;
 | ||
|                                                     newNode4.Nodes.Add(newNode5);
 | ||
|                                                     var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                       where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
 | ||
|                                                                       orderby x.SortIndex
 | ||
|                                                                       select x).ToList();
 | ||
|                                                     if (list.Contains(division1.DivisionProjectId))
 | ||
|                                                     {
 | ||
|                                                         newNode5.Expanded = true;
 | ||
|                                                         foreach (var division2 in division2s)
 | ||
|                                                         {
 | ||
|                                                             TreeNode newNode6 = new TreeNode();
 | ||
|                                                             newNode6.Text = division2.DivisionName;
 | ||
|                                                             newNode6.NodeID = division2.DivisionProjectId;
 | ||
|                                                             newNode6.CommandName = "DivisionProject";
 | ||
|                                                             newNode6.EnableExpandEvent = true;
 | ||
|                                                             newNode6.EnableClickEvent = true;
 | ||
|                                                             newNode5.Nodes.Add(newNode6);
 | ||
|                                                             var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                               where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
 | ||
|                                                                               orderby x.SortIndex
 | ||
|                                                                               select x).ToList();
 | ||
|                                                             if (list.Contains(division2.DivisionProjectId))
 | ||
|                                                             {
 | ||
|                                                                 newNode6.Expanded = true;
 | ||
|                                                             }
 | ||
|                                                             else
 | ||
|                                                             {
 | ||
|                                                                 if (division3s.Count > 0)
 | ||
|                                                                 {
 | ||
|                                                                     TreeNode tempNode2 = new TreeNode();
 | ||
|                                                                     tempNode2.NodeID = "";
 | ||
|                                                                     tempNode2.Text = "";
 | ||
|                                                                     newNode6.Nodes.Add(tempNode2);
 | ||
|                                                                 }
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                     else
 | ||
|                                                     {
 | ||
|                                                         if (division2s.Count > 0)
 | ||
|                                                         {
 | ||
|                                                             TreeNode tempNode2 = new TreeNode();
 | ||
|                                                             tempNode2.NodeID = "";
 | ||
|                                                             tempNode2.Text = "";
 | ||
|                                                             newNode5.Nodes.Add(tempNode2);
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                             else
 | ||
|                                             {
 | ||
|                                                 if (division1s.Count > 0)
 | ||
|                                                 {
 | ||
|                                                     TreeNode tempNode2 = new TreeNode();
 | ||
|                                                     tempNode2.NodeID = "";
 | ||
|                                                     tempNode2.Text = "";
 | ||
|                                                     newNode4.Nodes.Add(tempNode2);
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                         }
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                          where x.CNProfessionalId == BLL.Const.CNProfessionalConstructId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
 | ||
|                                                          orderby x.SortIndex
 | ||
|                                                          select x).ToList();
 | ||
|                                         foreach (var q in divisions)
 | ||
|                                         {
 | ||
|                                             TreeNode newNode4 = new TreeNode();
 | ||
|                                             newNode4.Text = q.DivisionName;
 | ||
|                                             newNode4.NodeID = q.DivisionProjectId;
 | ||
|                                             newNode4.CommandName = "DivisionProject";
 | ||
|                                             newNode4.EnableExpandEvent = true;
 | ||
|                                             newNode4.EnableClickEvent = true;
 | ||
|                                             trWBS.Nodes[i].Nodes[j].Nodes.Add(newNode4);
 | ||
|                                             if (q.IsSelected == true)
 | ||
|                                             {
 | ||
|                                                 newNode4.Checked = true;
 | ||
|                                             }
 | ||
|                                             var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                               where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
 | ||
|                                                               orderby x.SortIndex
 | ||
|                                                               select x).ToList();
 | ||
|                                             if (list.Contains(q.DivisionProjectId))
 | ||
|                                             {
 | ||
|                                                 newNode4.Expanded = true;
 | ||
|                                                 foreach (var division1 in division1s)
 | ||
|                                                 {
 | ||
|                                                     TreeNode newNode5 = new TreeNode();
 | ||
|                                                     newNode5.Text = division1.DivisionName;
 | ||
|                                                     newNode5.NodeID = division1.DivisionProjectId;
 | ||
|                                                     newNode5.CommandName = "DivisionProject";
 | ||
|                                                     newNode5.EnableExpandEvent = true;
 | ||
|                                                     newNode5.EnableClickEvent = true;
 | ||
|                                                     newNode4.Nodes.Add(newNode5);
 | ||
|                                                     var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                       where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
 | ||
|                                                                       orderby x.SortIndex
 | ||
|                                                                       select x).ToList();
 | ||
|                                                     if (list.Contains(division1.DivisionProjectId))
 | ||
|                                                     {
 | ||
|                                                         newNode5.Expanded = true;
 | ||
|                                                         foreach (var division2 in division2s)
 | ||
|                                                         {
 | ||
|                                                             TreeNode newNode6 = new TreeNode();
 | ||
|                                                             newNode6.Text = division2.DivisionName;
 | ||
|                                                             newNode6.NodeID = division2.DivisionProjectId;
 | ||
|                                                             newNode6.CommandName = "DivisionProject";
 | ||
|                                                             newNode6.EnableExpandEvent = true;
 | ||
|                                                             newNode6.EnableClickEvent = true;
 | ||
|                                                             newNode5.Nodes.Add(newNode6);
 | ||
|                                                             var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                               where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
 | ||
|                                                                               orderby x.SortIndex
 | ||
|                                                                               select x).ToList();
 | ||
|                                                             if (list.Contains(division2.DivisionProjectId))
 | ||
|                                                             {
 | ||
|                                                                 newNode6.Expanded = true;
 | ||
|                                                             }
 | ||
|                                                             else
 | ||
|                                                             {
 | ||
|                                                                 if (division3s.Count > 0)
 | ||
|                                                                 {
 | ||
|                                                                     TreeNode tempNode2 = new TreeNode();
 | ||
|                                                                     tempNode2.NodeID = "";
 | ||
|                                                                     tempNode2.Text = "";
 | ||
|                                                                     newNode6.Nodes.Add(tempNode2);
 | ||
|                                                                 }
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                     else
 | ||
|                                                     {
 | ||
|                                                         if (division2s.Count > 0)
 | ||
|                                                         {
 | ||
|                                                             TreeNode tempNode2 = new TreeNode();
 | ||
|                                                             tempNode2.NodeID = "";
 | ||
|                                                             tempNode2.Text = "";
 | ||
|                                                             newNode5.Nodes.Add(tempNode2);
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                             else
 | ||
|                                             {
 | ||
|                                                 if (division1s.Count > 0)
 | ||
|                                                 {
 | ||
|                                                     TreeNode tempNode2 = new TreeNode();
 | ||
|                                                     tempNode2.NodeID = "";
 | ||
|                                                     tempNode2.Text = "";
 | ||
|                                                     newNode4.Nodes.Add(tempNode2);
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                         }
 | ||
|                                     }
 | ||
|                                 }
 | ||
|                                 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 = c.CNProfessionalId;
 | ||
|                                         newCNProfessionalNode.CommandName = "CNProfessional";
 | ||
|                                         newCNProfessionalNode.EnableExpandEvent = true;
 | ||
|                                         newCNProfessionalNode.EnableClickEvent = true;
 | ||
|                                         trWBS.Nodes[i].Nodes[j].Nodes.Add(newCNProfessionalNode);
 | ||
|                                         if (c.CNProfessionalId == cNProfessionalId)
 | ||
|                                         {
 | ||
|                                             newCNProfessionalNode.Expanded = true;
 | ||
|                                             var divisions = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                              where x.CNProfessionalId == c.CNProfessionalId && x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == null && x.UnitWorkId == unitWorkId
 | ||
|                                                              orderby x.SortIndex
 | ||
|                                                              select x).ToList();
 | ||
|                                             foreach (var q in divisions)
 | ||
|                                             {
 | ||
|                                                 TreeNode newNode4 = new TreeNode();
 | ||
|                                                 newNode4.Text = q.DivisionName;
 | ||
|                                                 newNode4.NodeID = q.DivisionProjectId;
 | ||
|                                                 newNode4.CommandName = "DivisionProject";
 | ||
|                                                 newNode4.EnableExpandEvent = true;
 | ||
|                                                 newNode4.EnableClickEvent = true;
 | ||
|                                                 newCNProfessionalNode.Nodes.Add(newNode4);
 | ||
|                                                 if (q.IsSelected == true)
 | ||
|                                                 {
 | ||
|                                                     newNode4.Checked = true;
 | ||
|                                                 }
 | ||
|                                                 var division1s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                   where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == q.DivisionProjectId
 | ||
|                                                                   orderby x.SortIndex
 | ||
|                                                                   select x).ToList();
 | ||
|                                                 if (list.Contains(q.DivisionProjectId))
 | ||
|                                                 {
 | ||
|                                                     newNode4.Expanded = true;
 | ||
|                                                     foreach (var division1 in division1s)
 | ||
|                                                     {
 | ||
|                                                         TreeNode newNode5 = new TreeNode();
 | ||
|                                                         newNode5.Text = division1.DivisionName;
 | ||
|                                                         newNode5.NodeID = division1.DivisionProjectId;
 | ||
|                                                         newNode5.CommandName = "DivisionProject";
 | ||
|                                                         newNode5.EnableExpandEvent = true;
 | ||
|                                                         newNode5.EnableClickEvent = true;
 | ||
|                                                         newNode4.Nodes.Add(newNode5);
 | ||
|                                                         var division2s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                           where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division1.DivisionProjectId
 | ||
|                                                                           orderby x.SortIndex
 | ||
|                                                                           select x).ToList();
 | ||
|                                                         if (list.Contains(division1.DivisionProjectId))
 | ||
|                                                         {
 | ||
|                                                             newNode5.Expanded = true;
 | ||
|                                                             foreach (var division2 in division2s)
 | ||
|                                                             {
 | ||
|                                                                 TreeNode newNode6 = new TreeNode();
 | ||
|                                                                 newNode6.Text = division2.DivisionName;
 | ||
|                                                                 newNode6.NodeID = division2.DivisionProjectId;
 | ||
|                                                                 newNode6.CommandName = "DivisionProject";
 | ||
|                                                                 newNode6.EnableExpandEvent = true;
 | ||
|                                                                 newNode6.EnableClickEvent = true;
 | ||
|                                                                 newNode5.Nodes.Add(newNode6);
 | ||
|                                                                 var division3s = (from x in BLL.Funs.DB.WBS_DivisionProject
 | ||
|                                                                                   where x.ProjectId == this.CurrUser.LoginProjectId && x.SuperDivisionId == division2.DivisionProjectId
 | ||
|                                                                                   orderby x.SortIndex
 | ||
|                                                                                   select x).ToList();
 | ||
|                                                                 if (list.Contains(division2.DivisionProjectId))
 | ||
|                                                                 {
 | ||
|                                                                     newNode6.Expanded = true;
 | ||
|                                                                 }
 | ||
|                                                                 else
 | ||
|                                                                 {
 | ||
|                                                                     if (division3s.Count > 0)
 | ||
|                                                                     {
 | ||
|                                                                         TreeNode tempNode2 = new TreeNode();
 | ||
|                                                                         tempNode2.NodeID = "";
 | ||
|                                                                         tempNode2.Text = "";
 | ||
|                                                                         newNode6.Nodes.Add(tempNode2);
 | ||
|                                                                     }
 | ||
|                                                                 }
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                         else
 | ||
|                                                         {
 | ||
|                                                             if (division2s.Count > 0)
 | ||
|                                                             {
 | ||
|                                                                 TreeNode tempNode2 = new TreeNode();
 | ||
|                                                                 tempNode2.NodeID = "";
 | ||
|                                                                 tempNode2.Text = "";
 | ||
|                                                                 newNode5.Nodes.Add(tempNode2);
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                 }
 | ||
|                                                 else
 | ||
|                                                 {
 | ||
|                                                     if (division1s.Count > 0)
 | ||
|                                                     {
 | ||
|                                                         TreeNode tempNode2 = new TreeNode();
 | ||
|                                                         tempNode2.NodeID = "";
 | ||
|                                                         tempNode2.Text = "";
 | ||
|                                                         newNode4.Nodes.Add(tempNode2);
 | ||
|                                                     }
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                         }
 | ||
|                                         else
 | ||
|                                         {
 | ||
|                                             TreeNode tempNode2 = new TreeNode();
 | ||
|                                             tempNode2.NodeID = "";
 | ||
|                                             tempNode2.Text = "";
 | ||
|                                             newCNProfessionalNode.Nodes.Add(tempNode2);
 | ||
|                                         }
 | ||
|                                     }
 | ||
|                                 }
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 TreeNode tempNode2 = new TreeNode();
 | ||
|                                 tempNode2.NodeID = "";
 | ||
|                                 tempNode2.Text = "";
 | ||
|                                 trWBS.Nodes[i].Nodes[j].Nodes.Add(tempNode2);
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     TreeNode tempNode1 = new TreeNode();
 | ||
|                     tempNode1.NodeID = "";
 | ||
|                     tempNode1.Text = "";
 | ||
|                     trWBS.Nodes[i].Nodes.Add(tempNode1);
 | ||
|                 }
 | ||
|             }
 | ||
|             this.trWBS.SelectedNodeID = this.hdSelectId.Text;
 | ||
|             BindGrid();
 | ||
|         }
 | ||
| 
 | ||
|         private string GetCNProfessionalId(Model.WBS_DivisionProject divisionProject)
 | ||
|         {
 | ||
|             string id = string.Empty;
 | ||
|             if (divisionProject != null && !string.IsNullOrEmpty(divisionProject.CNProfessionalId))
 | ||
|             {
 | ||
|                 id = divisionProject.CNProfessionalId;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(divisionProject.SuperDivisionId);
 | ||
|                 id = GetCNProfessionalId(superDivisionProject);
 | ||
|             }
 | ||
|             return id;
 | ||
|         }
 | ||
| 
 | ||
|         private List<string> GetDivisionProjectIds(Model.WBS_DivisionProject divisionProject)
 | ||
|         {
 | ||
|             List<string> list = new List<string>();
 | ||
|             if (divisionProject != null && !string.IsNullOrEmpty(divisionProject.SuperDivisionId))
 | ||
|             {
 | ||
|                 list.Add(divisionProject.SuperDivisionId);
 | ||
|                 Model.WBS_DivisionProject superDivisionProject = BLL.DivisionProjectService.GetDivisionProjectById(divisionProject.SuperDivisionId);
 | ||
|                 list.AddRange(GetDivisionProjectIds(superDivisionProject));
 | ||
|             }
 | ||
|             return list;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  行点击事件
 | ||
|         protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
 | ||
|         {
 | ||
|             string id = e.RowID;
 | ||
|             if (e.CommandName.Equals("download"))
 | ||
|             {
 | ||
|                 string menuId = Const.ProjectControlPointMenuId;
 | ||
|                 PageContext.RegisterStartupScript(Windowtt.GetShowReference(
 | ||
|                  String.Format("../../AttachFile/webuploader.aspx?type=0&source=1&toKeyId={0}&path=FileUpload/BreakdownProject&menuId={1}", id, menuId)));
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|          
 | ||
| 
 | ||
|         #region 获取按钮权限
 | ||
|         /// <summary>
 | ||
|         /// 获取按钮权限
 | ||
|         /// </summary>
 | ||
|         /// <param name="button"></param>
 | ||
|         /// <returns></returns>
 | ||
|         private void GetButtonPower()
 | ||
|         {
 | ||
|             if (Request.Params["value"] == "0")
 | ||
|             {
 | ||
|                 return;
 | ||
|             }
 | ||
|             var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointMenuId);
 | ||
|             if (buttonList.Count() > 0)
 | ||
|             {  
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
|     }
 | ||
| } |