992 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			992 lines
		
	
	
		
			45 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | ||
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Data;
 | ||
| using System.Data.SqlClient;
 | ||
| using System.Linq;
 | ||
| 
 | ||
| namespace FineUIPro.Web.JDGL.WBS
 | ||
| {
 | ||
|     public partial class WBSSet : PageBase
 | ||
|     {
 | ||
|         #region 定义项
 | ||
|         private static TreeNode node;
 | ||
|         private static string type;
 | ||
|         private static TreeNode delNode;
 | ||
|         private static string operating = null;
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  页面加载
 | ||
|         /// <summary>
 | ||
|         /// 页面加载
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Page_Load(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (!IsPostBack)
 | ||
|             {
 | ||
|                 GetButtonPower();
 | ||
|                 InitTreeMenu();
 | ||
|             }
 | ||
|         }
 | ||
|         #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.WBSSetMenuId);
 | ||
|             if (buttonList.Count() > 0)
 | ||
|             {
 | ||
|                 if (buttonList.Contains(BLL.Const.BtnAdd))
 | ||
|                 {
 | ||
|                     this.btnMenuAdd.Hidden = false;
 | ||
|                 }
 | ||
|                 if (buttonList.Contains(BLL.Const.BtnModify))
 | ||
|                 {
 | ||
|                     this.btnMenuEdit.Hidden = false;
 | ||
|                     this.btnMenuModify.Hidden = false;
 | ||
|                 }
 | ||
|                 if (buttonList.Contains(BLL.Const.BtnDelete))
 | ||
|                 {
 | ||
|                     this.btnMenuDelete.Hidden = false;
 | ||
|                     this.btnMenuDel.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 cnProfessions = from x in Funs.DB.WBS_CnProfessionInit orderby x.SortIndex select x;
 | ||
|             foreach (var cnProfession in cnProfessions)
 | ||
|             {
 | ||
|                 TreeNode rootNode = new TreeNode();
 | ||
|                 rootNode.Text = cnProfession.CnProfessionName;
 | ||
|                 rootNode.NodeID = cnProfession.CnProfessionId.ToString();
 | ||
|                 rootNode.CommandName = "cnProfession";
 | ||
|                 rootNode.EnableExpandEvent = true;
 | ||
|                 rootNode.EnableClickEvent = true;
 | ||
|                 this.trWBS.Nodes.Add(rootNode);
 | ||
|                 TreeNode emptyNode = new TreeNode();
 | ||
|                 emptyNode.Text = "";
 | ||
|                 emptyNode.NodeID = "";
 | ||
|                 rootNode.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 == "cnProfession")   //展开专业节点
 | ||
|             {
 | ||
|                 var unitProjects = from x in Funs.DB.Wbs_UnitProjectInit where x.CnProfessionId == Convert.ToInt32(e.Node.NodeID) && x.SuperUnitProject == null orderby x.SortIndex select x;
 | ||
|                 foreach (var unitProject in unitProjects)
 | ||
|                 {
 | ||
|                     TreeNode newNode = new TreeNode();
 | ||
|                     newNode.Text = unitProject.UnitProjectName;
 | ||
|                     newNode.NodeID = unitProject.UnitProjectCode;
 | ||
|                     newNode.CommandName = "unitProject";
 | ||
|                     newNode.EnableExpandEvent = true;
 | ||
|                     newNode.EnableClickEvent = true;
 | ||
|                     e.Node.Nodes.Add(newNode);
 | ||
|                     TreeNode emptyNode = new TreeNode();
 | ||
|                     emptyNode.Text = "";
 | ||
|                     emptyNode.NodeID = "";
 | ||
|                     newNode.Nodes.Add(emptyNode);
 | ||
|                 }
 | ||
|             }
 | ||
|             else if (e.Node.CommandName == "unitProject")   //展开单位工程节点
 | ||
|             {
 | ||
|                 var wbsSet1s = from x in Funs.DB.WBS_WbsSetInit where x.UnitProjectCode == e.Node.NodeID && x.SuperWbsSetCode == null orderby x.WbsSetCode select x;
 | ||
|                 if (wbsSet1s.Count() > 0)
 | ||
|                 {
 | ||
|                     foreach (var wbsSet1 in wbsSet1s)
 | ||
|                     {
 | ||
|                         TreeNode newNode = new TreeNode();
 | ||
|                         newNode.Text = wbsSet1.WbsSetName;
 | ||
|                         newNode.NodeID = wbsSet1.WbsSetCode;
 | ||
|                         newNode.CommandName = "wbsSet";
 | ||
|                         newNode.EnableExpandEvent = true;
 | ||
|                         newNode.EnableClickEvent = true;
 | ||
|                         e.Node.Nodes.Add(newNode);
 | ||
|                         TreeNode emptyNode = new TreeNode();
 | ||
|                         emptyNode.Text = "";
 | ||
|                         emptyNode.NodeID = "";
 | ||
|                         newNode.Nodes.Add(emptyNode);
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else if (e.Node.CommandName == "wbsSet")   //展开分部/子分部/分项/子分项工程节点
 | ||
|             {
 | ||
|                 var childWbsSets = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(e.Node.NodeID);
 | ||
|                 foreach (var wbsSet in childWbsSets)
 | ||
|                 {
 | ||
|                     TreeNode newNode = new TreeNode();
 | ||
|                     newNode.Text = wbsSet.WbsSetName;
 | ||
|                     newNode.NodeID = wbsSet.WbsSetCode;
 | ||
|                     newNode.CommandName = "wbsSet";
 | ||
|                     newNode.EnableExpandEvent = true;
 | ||
|                     newNode.EnableClickEvent = true;
 | ||
|                     e.Node.Nodes.Add(newNode);
 | ||
|                     var childWbsSets2 = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(newNode.NodeID);
 | ||
|                     if (childWbsSets2.Count() > 0)
 | ||
|                     {
 | ||
|                         TreeNode emptyNode = new TreeNode();
 | ||
|                         emptyNode.Text = "";
 | ||
|                         emptyNode.NodeID = "";
 | ||
|                         newNode.Nodes.Add(emptyNode);
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  Tree点击事件
 | ||
|         /// <summary>
 | ||
|         /// Tree点击事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void trWBS_NodeCommand(object sender, TreeCommandEventArgs e)
 | ||
|         {
 | ||
|             //if (this.Grid1.Rows.Count > 0)
 | ||
|             //{
 | ||
|             //    SaveData();
 | ||
|             //}
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  保存方法
 | ||
|         /// <summary>
 | ||
|         /// 保存方法
 | ||
|         /// </summary>
 | ||
|         private void SaveData()
 | ||
|         {
 | ||
|             //string rowId = this.Grid1.Rows[0].RowID;
 | ||
|             //string type = this.Grid1.Rows[0].Values[4].ToString();
 | ||
| 
 | ||
|             //if (type == "unitProject")
 | ||
|             //{
 | ||
|             //    Model.Wbs_UnitProjectInit unitProject = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(rowId);
 | ||
|             //    if (unitProject != null)
 | ||
|             //    {
 | ||
|             //        BLL.UnitProjectInitService.UpdateUnitProjectInit(unitProject);
 | ||
|             //    }
 | ||
|             //}
 | ||
|             //else if (type == "wbsSet")
 | ||
|             //{
 | ||
|             //    Model.WBS_WbsSetInit wbsSet = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(rowId);
 | ||
|             //    if (wbsSet != null)
 | ||
|             //    {
 | ||
|             //        var childWbsSets = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(this.trWBS.SelectedNodeID);
 | ||
|             //        //wbsSet.StartDate = Convert.ToDateTime(this.Grid1.Rows[0].Values[2].ToString());
 | ||
|             //        //wbsSet.EndDate = Convert.ToDateTime(this.Grid1.Rows[0].Values[3].ToString());
 | ||
|             //        BLL.WbsSetInitService.UpdateWbsSetInit(wbsSet);
 | ||
|             //    }
 | ||
|             //}
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  关闭窗口
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window1_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             getWBSSet();
 | ||
|         }
 | ||
|         
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window2_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             getWBSSet();
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 关闭窗口
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void Window3_Close(object sender, WindowCloseEventArgs e)
 | ||
|         {
 | ||
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 右键增加、修改、删除方法
 | ||
|         /// <summary>
 | ||
|         /// 右键修改事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnMenuEdit_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (this.trWBS.SelectedNode != null)
 | ||
|             {
 | ||
|                 if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetMenuId, BLL.Const.BtnModify))
 | ||
|                 {
 | ||
|                     type = this.trWBS.SelectedNode.CommandName;
 | ||
|                     if (type.Equals("cnProfession"))
 | ||
|                     {
 | ||
|                         ShowNotify("专业不允许修改!", MessageBoxIcon.Warning);
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         this.hdSelectId.Text = this.trWBS.SelectedNodeID;
 | ||
|                         node = trWBS.SelectedNode;
 | ||
|                         operating = "modify";
 | ||
|                         PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("WBSSetEdit.aspx?operating=modify&Id={0}&Type={1}", this.trWBS.SelectedNodeID, this.trWBS.SelectedNode.CommandName, "编辑 - ")));
 | ||
|                     }
 | ||
| 
 | ||
| 
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 增加费控项
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnAdd_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|             if (!string.IsNullOrEmpty(trWBS.SelectedNodeID))
 | ||
|             {
 | ||
|                 if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetMenuId, BLL.Const.BtnAdd))
 | ||
|                 {
 | ||
|                     type = this.trWBS.SelectedNode.CommandName;
 | ||
|                     this.hdSelectId.Text = this.trWBS.SelectedNodeID;
 | ||
|                     Model.WBS_WbsSetInit wbsSet = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(this.trWBS.SelectedNodeID);
 | ||
|                     if (wbsSet != null)
 | ||
|                     {
 | ||
|                         var list = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(this.trWBS.SelectedNodeID);
 | ||
|                         if (list.Count == 0)
 | ||
|                         {
 | ||
|                             operating = "add";
 | ||
|                             string openUrl = String.Format("CostControlEdit.aspx?operating=add&Id={0}", trWBS.SelectedNodeID, "增加 - ");
 | ||
|                             PageContext.RegisterStartupScript(Window3.GetShowReference(openUrl));
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             ShowNotify("请选择工作项节点进行增加!", MessageBoxIcon.Warning);
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         ShowNotify("请选择工作项节点进行增加!", MessageBoxIcon.Warning);
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 增加
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnMenuAdd_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
| 
 | ||
|             if (!string.IsNullOrEmpty(trWBS.SelectedNodeID))
 | ||
|             {
 | ||
|                 if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetMenuId, BLL.Const.BtnAdd))
 | ||
|                 {
 | ||
|                     //if (this.trWBS.SelectedNode.CommandName != "cnProfession")   //非专业节点可以增加
 | ||
|                     //{
 | ||
|                     type = this.trWBS.SelectedNode.CommandName;
 | ||
|                     this.hdSelectId.Text = this.trWBS.SelectedNodeID;
 | ||
|                     node = trWBS.SelectedNode;
 | ||
|                     operating = "add";
 | ||
|                     string openUrl = String.Format("WBSSetEdit.aspx?operating=add&Id={0}&Type={1}", trWBS.SelectedNodeID, trWBS.SelectedNode.CommandName, "拷贝 - ");
 | ||
|                     PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
 | ||
|                             + Window2.GetShowReference(openUrl));
 | ||
|                     //PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WBSSetCopy.aspx?Id={0}&Type={1}", this.trWBS.SelectedNode.NodeID, this.trWBS.SelectedNode.CommandName, "拷贝 - ")));
 | ||
|                     //}
 | ||
|                     //else
 | ||
|                     //{
 | ||
|                     //    ShowNotify("专业节点无法增加!", MessageBoxIcon.Warning);
 | ||
|                     //}
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 右键删除事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnMenuDelete_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (this.trWBS.SelectedNode != null)
 | ||
|             {
 | ||
|                 if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetMenuId, BLL.Const.BtnDelete))
 | ||
|                 {
 | ||
|                     if (this.trWBS.SelectedNode.CommandName != "cnProfession")   //非专业节点可以删除
 | ||
|                     {
 | ||
|                         var strId = trWBS.SelectedNode.NodeID.Split('-');
 | ||
|                         if (strId.Count() == 2)
 | ||
|                         {
 | ||
|                             delNode = trWBS.SelectedNode;
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             node = trWBS.SelectedNode;
 | ||
|                         }
 | ||
|                         DeleteData();
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         ShowNotify("专业节点无法删除!", MessageBoxIcon.Warning);
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 删除方法
 | ||
|         /// </summary>
 | ||
|         private void DeleteData()
 | ||
|         {
 | ||
|             string id = this.trWBS.SelectedNodeID;
 | ||
|             if (this.trWBS.SelectedNode.CommandName == "unitProject")
 | ||
|             {
 | ||
|                 Model.Wbs_UnitProjectInit unitProject = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(id);
 | ||
|                 if (unitProject != null)
 | ||
|                 {
 | ||
|                     if (unitProject.IsIn == true)
 | ||
|                     {
 | ||
|                         ShowNotify("内置项无法删除!", MessageBoxIcon.Warning);
 | ||
|                         return;
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         List<Model.Wbs_UnitProjectInit> childUnitProjects = BLL.UnitProjectInitService.GetUnitProjectInitsBySuperUnitProject(id);
 | ||
| 
 | ||
|                         if (childUnitProjects.Count > 0)   //存在子单位工程
 | ||
|                         {
 | ||
|                             this.hdSelectId.Text = unitProject.CnProfessionId.ToString();
 | ||
|                             foreach (var childUnitProject in childUnitProjects)
 | ||
|                             {
 | ||
|                                 BLL.WbsSetInitService.DeleteWbsSetInitByUnitProjectCode(childUnitProject.UnitProjectCode);
 | ||
|                             }
 | ||
|                             BLL.UnitProjectInitService.DeleteUnitProjectInitBySuperUnitProject(id);
 | ||
|                             BLL.UnitProjectInitService.DeleteUnitProjectInit(id);
 | ||
|                         }
 | ||
|                         else
 | ||
|                         {
 | ||
|                             this.hdSelectId.Text = unitProject.CnProfessionId.ToString();
 | ||
|                             BLL.WbsSetInitService.DeleteWbsSetInitByUnitProjectCode(id);
 | ||
|                             BLL.UnitProjectInitService.DeleteUnitProjectInit(id);
 | ||
|                         }
 | ||
| 
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else if (this.trWBS.SelectedNode.CommandName == "childUnitProject")
 | ||
|             {
 | ||
|                 Model.Wbs_UnitProjectInit childUnitProject = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(id);
 | ||
|                 if (childUnitProject != null)
 | ||
|                 {
 | ||
|                     if (childUnitProject.IsIn == true)
 | ||
|                     {
 | ||
|                         ShowNotify("内置项无法删除!", MessageBoxIcon.Warning);
 | ||
|                         return;
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         this.hdSelectId.Text = childUnitProject.SuperUnitProject;
 | ||
|                         BLL.WbsSetInitService.DeleteWbsSetInitByUnitProjectCode(id);
 | ||
|                         BLL.UnitProjectInitService.DeleteUnitProjectInit(id);
 | ||
| 
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else if (this.trWBS.SelectedNode.CommandName == "wbsSet")
 | ||
|             {
 | ||
|                 Model.WBS_WbsSetInit wbsSet = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(id);
 | ||
|                 if (wbsSet != null)
 | ||
|                 {
 | ||
|                     if (wbsSet.IsIn == true)
 | ||
|                     {
 | ||
|                         ShowNotify("内置项无法删除!", MessageBoxIcon.Warning);
 | ||
|                         return;
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         List<Model.WBS_WbsSetInit> childWbsSet1s = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(id);
 | ||
| 
 | ||
|                         Model.WBS_WbsSetInit set = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(id);
 | ||
|                         if (set != null)
 | ||
|                         {
 | ||
|                             if (!string.IsNullOrEmpty(set.SuperWbsSetCode))
 | ||
|                             {
 | ||
|                                 this.hdSelectId.Text = wbsSet.SuperWbsSetCode;
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 this.hdSelectId.Text = wbsSet.UnitProjectCode;
 | ||
|                             }
 | ||
|                         }
 | ||
| 
 | ||
|                         foreach (var childWbsSet1 in childWbsSet1s)
 | ||
|                         {
 | ||
|                             List<Model.WBS_WbsSetInit> childWbsSet2s = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(childWbsSet1.WbsSetCode);
 | ||
|                             foreach (var childWbsSet2 in childWbsSet2s)//3
 | ||
|                             {
 | ||
|                                 List<Model.WBS_WbsSetInit> childWbsSet3s = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(childWbsSet2.WbsSetCode);
 | ||
|                                 foreach (var childWbsSet3 in childWbsSet3s)
 | ||
|                                 {
 | ||
|                                     BLL.WbsSetInitService.DeleteWbsSetInit(childWbsSet3.WbsSetCode);
 | ||
|                                 }
 | ||
|                                 BLL.WbsSetInitService.DeleteWbsSetInit(childWbsSet2.WbsSetCode);
 | ||
|                             }
 | ||
|                             BLL.WbsSetInitService.DeleteWbsSetInit(childWbsSet1.WbsSetCode);
 | ||
|                         }
 | ||
| 
 | ||
|                         BLL.WbsSetInitService.DeleteWbsSetInit(id);
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             BLL.LogService.AddSys_Log(this.CurrUser, id, id, BLL.Const.WBSSetMenuId, "删除WBS库单位、分部、分项工程!");
 | ||
|             ShowNotify("删除成功!", MessageBoxIcon.Success);
 | ||
| 
 | ||
|             getWBSSet();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region  保存事件
 | ||
|         /// <summary>
 | ||
|         /// 保存事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnSave_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetMenuId, BLL.Const.BtnSave))
 | ||
|             {
 | ||
|                 if (this.Grid1.Rows.Count > 0)
 | ||
|                 {
 | ||
|                     SaveData();
 | ||
|                     Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | ||
|                     return;
 | ||
|                 }
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | ||
|             }
 | ||
|         }
 | ||
|         #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()
 | ||
|         {
 | ||
|             var codeList = BLL.WbsSetMatchCostControlInitService.GetWbsSetMatchCostControlInits(this.trWBS.SelectedNodeID);
 | ||
|             if (codeList.Count > 0)   //存在费控对应关系项
 | ||
|             {
 | ||
|                 string codes = string.Empty;
 | ||
|                 foreach (var item in codeList)
 | ||
|                 {
 | ||
|                     codes += item.CostControlInitCode + ",";
 | ||
|                 }
 | ||
|                 string strSql = "SELECT * FROM WBS_CostControlInit where @CostControlInitCodes like '%'+CostControlInitCode+'%'";
 | ||
|                 List<SqlParameter> listStr = new List<SqlParameter>();
 | ||
|                 listStr.Add(new SqlParameter("@CostControlInitCodes", codes));
 | ||
|                 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();
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 Grid1.DataSource = null;
 | ||
|                 Grid1.DataBind();
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 判断字符串是否可以转化为数字
 | ||
|         /// <summary>
 | ||
|         /// 判断字符串是否可以转化为数字
 | ||
|         /// </summary>
 | ||
|         /// <param name="str">要检查的字符串</param>
 | ||
|         /// <returns>true:可以转换为数字;false:不是数字</returns>
 | ||
|         public bool IsNumberic(string str)
 | ||
|         {
 | ||
|             double vsNum;
 | ||
|             bool isNum;
 | ||
|             isNum = double.TryParse(str, System.Globalization.NumberStyles.Float,
 | ||
|                 System.Globalization.NumberFormatInfo.InvariantInfo, out vsNum);
 | ||
|             return isNum;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 根据所给Id定位到对应具体的专业、单位工程、分部、子分部、分项、子分项
 | ||
|         /// <summary>
 | ||
|         /// 根据所给Id定位到对应具体的专业、单位工程、分部、子分部、分项、子分项
 | ||
|         /// </summary>
 | ||
|         private void getWBSSet()
 | ||
|         {
 | ||
|             string CnProfessionCode = string.Empty;
 | ||
|             string UnitProjectCode = string.Empty;
 | ||
|             string CnProfessionId = String.Empty;
 | ||
|             string wbsSetParentCode1 = string.Empty;
 | ||
|             string wbsSetParentCode2 = string.Empty;
 | ||
|             string wbsSetParentCode3 = string.Empty;
 | ||
|             Model.WBS_CnProfessionInit cnPro = BLL.CnProfessionInitService.GetCnProfessionInitByCnProfessionId(this.hdSelectId.Text);
 | ||
|             Model.Wbs_UnitProjectInit UnitProject = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(this.hdSelectId.Text);
 | ||
|             Model.WBS_WbsSetInit wbsSetParm = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(this.hdSelectId.Text);
 | ||
| 
 | ||
|             if (UnitProject != null)
 | ||
|             {
 | ||
|                 if (string.IsNullOrEmpty(UnitProject.SuperUnitProject))
 | ||
|                 {
 | ||
|                     UnitProjectCode = UnitProject.UnitProjectCode;
 | ||
|                 }
 | ||
|                 Model.WBS_CnProfessionInit cn = BLL.CnProfessionInitService.GetCnProfessionInitByCnProfessionId(UnitProject.CnProfessionId.ToString());
 | ||
|                 if (cn != null)
 | ||
|                 {
 | ||
|                     if (type == "cnProfession" || type == "unitProject" || type == "wbsSet")
 | ||
|                     {
 | ||
|                         CnProfessionCode = cn.CnProfessionId.ToString();
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         CnProfessionCode = cn.CnProfessionCode;
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             else if (wbsSetParm != null)
 | ||
|             {
 | ||
|                 Model.WBS_CnProfessionInit cn = BLL.CnProfessionInitService.GetCnProfessionInitByCnProfessionId(wbsSetParm.CnProfessionId.ToString());
 | ||
|                 CnProfessionCode = wbsSetParm.CnProfessionId.ToString();
 | ||
|                 Model.Wbs_UnitProjectInit unitpro = BLL.UnitProjectInitService.GetUnitProjectInitByUnitProjectCode(wbsSetParm.UnitProjectCode);
 | ||
|                 if (string.IsNullOrEmpty(unitpro.SuperUnitProject))
 | ||
|                 {
 | ||
|                     UnitProjectCode = unitpro.UnitProjectCode;
 | ||
|                 }
 | ||
|                 if (!string.IsNullOrEmpty(wbsSetParm.SuperWbsSetCode))
 | ||
|                 {
 | ||
|                     wbsSetParentCode1 = wbsSetParm.SuperWbsSetCode;
 | ||
|                     Model.WBS_WbsSetInit wbsSetParent1 = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(wbsSetParentCode1);
 | ||
|                     if (wbsSetParent1 != null)
 | ||
|                     {
 | ||
|                         if (!string.IsNullOrEmpty(wbsSetParent1.SuperWbsSetCode))
 | ||
|                         {
 | ||
|                             wbsSetParentCode2 = wbsSetParent1.SuperWbsSetCode;
 | ||
|                             Model.WBS_WbsSetInit wbsSetParent2 = BLL.WbsSetInitService.GetWbsSetInitByWbsSetCode(wbsSetParentCode2);
 | ||
|                             if (wbsSetParent2 != null)
 | ||
|                             {
 | ||
|                                 if (!string.IsNullOrEmpty(wbsSetParent2.SuperWbsSetCode))
 | ||
|                                 {
 | ||
|                                     wbsSetParentCode3 = wbsSetParent2.SuperWbsSetCode;
 | ||
|                                 }
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
|             }
 | ||
|             if (delNode != null)
 | ||
|             {
 | ||
|                 if (delNode.ParentNode != null)
 | ||
|                 {
 | ||
|                     CnProfessionCode = cnPro.CnProfessionId.ToString();
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             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 cnProfessions = from x in Funs.DB.WBS_CnProfessionInit orderby x.SortIndex select x;
 | ||
|             foreach (var cnProfession in cnProfessions)
 | ||
|             {
 | ||
|                 TreeNode newCnProfessionNode = new TreeNode();
 | ||
|                 newCnProfessionNode.Text = cnProfession.CnProfessionName;
 | ||
|                 newCnProfessionNode.NodeID = cnProfession.CnProfessionId.ToString();
 | ||
|                 if (delNode != null)
 | ||
|                 {
 | ||
|                     if (delNode.ParentNode.NodeID == newCnProfessionNode.NodeID)
 | ||
|                     {
 | ||
|                         newCnProfessionNode.Expanded = true;
 | ||
|                     }
 | ||
| 
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     if (node.NodeID == newCnProfessionNode.NodeID)
 | ||
|                     {
 | ||
|                         newCnProfessionNode.Expanded = true;
 | ||
|                     }
 | ||
|                 }
 | ||
| 
 | ||
| 
 | ||
|                 newCnProfessionNode.CommandName = "cnProfession";
 | ||
|                 newCnProfessionNode.ToolTip = cnProfession.CnProfessionCode;
 | ||
|                 newCnProfessionNode.EnableExpandEvent = true;
 | ||
|                 newCnProfessionNode.EnableClickEvent = true;
 | ||
|                 this.trWBS.Nodes.Add(newCnProfessionNode);
 | ||
| 
 | ||
|                 if (!string.IsNullOrEmpty(UnitProjectCode) || delNode != null)
 | ||
|                 {
 | ||
|                     //加载专业下的单位工程
 | ||
| 
 | ||
|                     if (cnProfession.CnProfessionId.ToString().Equals(CnProfessionCode))
 | ||
|                     {
 | ||
|                         newCnProfessionNode.Expanded = true;
 | ||
|                         var UnitProjects = from x in Funs.DB.Wbs_UnitProjectInit where x.CnProfessionId.ToString() == CnProfessionCode && x.SuperUnitProject == null orderby x.SortIndex select x;
 | ||
|                         foreach (var unitProject in UnitProjects)
 | ||
|                         {
 | ||
|                             TreeNode newNodeUnitPorject = new TreeNode();
 | ||
|                             newNodeUnitPorject.Text = unitProject.UnitProjectName;
 | ||
|                             newNodeUnitPorject.NodeID = unitProject.UnitProjectCode;
 | ||
|                             newNodeUnitPorject.CommandName = "unitProject";
 | ||
|                             newNodeUnitPorject.EnableExpandEvent = true;
 | ||
|                             newNodeUnitPorject.EnableClickEvent = true;
 | ||
|                             newCnProfessionNode.Expanded = true;
 | ||
|                             newCnProfessionNode.Nodes.Add(newNodeUnitPorject);
 | ||
|                             if (unitProject.UnitProjectCode != UnitProjectCode)
 | ||
|                             {
 | ||
|                                 TreeNode emptyNode = new TreeNode();
 | ||
|                                 emptyNode.Text = "";
 | ||
|                                 emptyNode.NodeID = "";
 | ||
|                                 newNodeUnitPorject.Nodes.Add(emptyNode);
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 if (wbsSetParm != null)
 | ||
|                                 {
 | ||
|                                     if (wbsSetParm.UnitProjectCode != UnitProjectCode)
 | ||
|                                     {
 | ||
|                                         TreeNode emptyNode = new TreeNode();
 | ||
|                                         emptyNode.Text = "";
 | ||
|                                         emptyNode.NodeID = "";
 | ||
|                                         newNodeUnitPorject.Nodes.Add(emptyNode);
 | ||
|                                     }
 | ||
|                                     else
 | ||
|                                     {
 | ||
|                                         newNodeUnitPorject.Expanded = true;
 | ||
|                                         var wbsSet1s = from x in Funs.DB.WBS_WbsSetInit where x.UnitProjectCode == UnitProjectCode && x.SuperWbsSetCode == null orderby x.WbsSetCode select x;
 | ||
|                                         foreach (var wbsSet1 in wbsSet1s)
 | ||
|                                         {
 | ||
|                                             TreeNode newwbsSet1Node = new TreeNode();
 | ||
|                                             newwbsSet1Node.Text = wbsSet1.WbsSetName;
 | ||
|                                             newwbsSet1Node.NodeID = wbsSet1.WbsSetCode;
 | ||
|                                             newwbsSet1Node.CommandName = "wbsSet";
 | ||
|                                             newwbsSet1Node.ToolTip = wbsSet1.WbsSetCode;
 | ||
|                                             newwbsSet1Node.EnableExpandEvent = true;
 | ||
|                                             newwbsSet1Node.EnableClickEvent = true;
 | ||
|                                             newNodeUnitPorject.Nodes.Add(newwbsSet1Node);
 | ||
|                                             var childWbsSets2 = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(newwbsSet1Node.NodeID);
 | ||
|                                             if (childWbsSets2.Count() > 0)
 | ||
|                                             {
 | ||
|                                                 if (BLL.WbsSetInitService.IsExitWbsSetById2(wbsSet1.WbsSetCode, wbsSetParm.WbsSetCode))
 | ||
|                                                 {
 | ||
| 
 | ||
|                                                     foreach (var wbsSet2 in childWbsSets2)
 | ||
|                                                     {
 | ||
|                                                         if (wbsSet1.WbsSetCode == wbsSet2.SuperWbsSetCode)
 | ||
|                                                         {
 | ||
|                                                             newwbsSet1Node.Expanded = true;
 | ||
|                                                         }
 | ||
|                                                         TreeNode newwbsSet2Node = new TreeNode();
 | ||
|                                                         newwbsSet2Node.Text = wbsSet2.WbsSetName;
 | ||
|                                                         newwbsSet2Node.NodeID = wbsSet2.WbsSetCode;
 | ||
|                                                         newwbsSet2Node.CommandName = "wbsSet";
 | ||
|                                                         newwbsSet2Node.ToolTip = wbsSet2.WbsSetCode;
 | ||
|                                                         newwbsSet2Node.EnableExpandEvent = true;
 | ||
|                                                         newwbsSet2Node.EnableClickEvent = true;
 | ||
|                                                         newwbsSet1Node.Nodes.Add(newwbsSet2Node);
 | ||
|                                                         var childWbsSets3 = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(newwbsSet2Node.NodeID);
 | ||
|                                                         if (BLL.WbsSetInitService.IsExitWbsSetById2(wbsSet2.WbsSetCode, wbsSetParm.WbsSetCode))
 | ||
|                                                         {
 | ||
|                                                             newwbsSet2Node.Expanded = true;
 | ||
|                                                             if (childWbsSets3.Count() > 0)
 | ||
|                                                             {
 | ||
|                                                                 foreach (var wbsSet3 in childWbsSets3)
 | ||
|                                                                 {
 | ||
|                                                                     TreeNode newwbsSet3Node = new TreeNode();
 | ||
|                                                                     newwbsSet3Node.Text = wbsSet3.WbsSetName;
 | ||
|                                                                     newwbsSet3Node.NodeID = wbsSet3.WbsSetCode;
 | ||
|                                                                     newwbsSet3Node.CommandName = "wbsSet";
 | ||
|                                                                     newwbsSet3Node.ToolTip = wbsSet3.WbsSetCode;
 | ||
|                                                                     newwbsSet3Node.EnableExpandEvent = true;
 | ||
|                                                                     newwbsSet3Node.EnableClickEvent = true;
 | ||
|                                                                     newwbsSet2Node.Nodes.Add(newwbsSet3Node);
 | ||
|                                                                     var childWbsSets4 = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(newwbsSet3Node.NodeID);
 | ||
|                                                                     if (BLL.WbsSetInitService.IsExitWbsSetById2(wbsSet3.WbsSetCode, wbsSetParm.WbsSetCode))
 | ||
|                                                                     {
 | ||
|                                                                         newwbsSet3Node.Expanded = true;
 | ||
|                                                                         if (childWbsSets4.Count() > 0)
 | ||
|                                                                         {
 | ||
|                                                                             foreach (var wbsSet4 in childWbsSets4)
 | ||
|                                                                             {
 | ||
|                                                                                 TreeNode newwbsSet4Node = new TreeNode();
 | ||
|                                                                                 newwbsSet4Node.Text = wbsSet4.WbsSetName;
 | ||
|                                                                                 newwbsSet4Node.NodeID = wbsSet4.WbsSetCode;
 | ||
|                                                                                 newwbsSet4Node.CommandName = "wbsSet";
 | ||
|                                                                                 newwbsSet4Node.ToolTip = wbsSet4.WbsSetCode;
 | ||
|                                                                                 newwbsSet4Node.EnableExpandEvent = true;
 | ||
|                                                                                 newwbsSet4Node.EnableClickEvent = true;
 | ||
|                                                                                 newwbsSet3Node.Nodes.Add(newwbsSet4Node);
 | ||
|                                                                             }
 | ||
|                                                                         }
 | ||
|                                                                     }
 | ||
|                                                                     else
 | ||
|                                                                     {
 | ||
|                                                                         if (childWbsSets4.Count() > 0)
 | ||
|                                                                         {
 | ||
|                                                                             TreeNode emptyNode = new TreeNode();
 | ||
|                                                                             emptyNode.Text = "";
 | ||
|                                                                             emptyNode.NodeID = "";
 | ||
|                                                                             newwbsSet3Node.Nodes.Add(emptyNode);
 | ||
|                                                                         }
 | ||
|                                                                     }
 | ||
|                                                                 }
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                         else
 | ||
|                                                         {
 | ||
|                                                             if (childWbsSets3.Count() > 0)
 | ||
|                                                             {
 | ||
|                                                                 TreeNode emptyNode = new TreeNode();
 | ||
|                                                                 emptyNode.Text = "";
 | ||
|                                                                 emptyNode.NodeID = "";
 | ||
|                                                                 newwbsSet2Node.Nodes.Add(emptyNode);
 | ||
|                                                             }
 | ||
|                                                         }
 | ||
|                                                     }
 | ||
|                                                 }
 | ||
|                                                 else
 | ||
|                                                 {
 | ||
|                                                     TreeNode emptyNode = new TreeNode();
 | ||
|                                                     emptyNode.Text = "";
 | ||
|                                                     emptyNode.NodeID = "";
 | ||
|                                                     newwbsSet1Node.Nodes.Add(emptyNode);
 | ||
|                                                 }
 | ||
|                                             }
 | ||
|                                         }
 | ||
|                                     }
 | ||
|                                 }
 | ||
|                                 else
 | ||
|                                 {
 | ||
|                                     TreeNode emptyNode = new TreeNode();
 | ||
|                                     emptyNode.Text = "";
 | ||
|                                     emptyNode.NodeID = "";
 | ||
|                                     newNodeUnitPorject.Nodes.Add(emptyNode);
 | ||
|                                 }
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
|                     else
 | ||
|                     {
 | ||
|                         TreeNode emptyNode = new TreeNode();
 | ||
|                         emptyNode.Text = "";
 | ||
|                         emptyNode.NodeID = "";
 | ||
|                         newCnProfessionNode.Nodes.Add(emptyNode);
 | ||
|                     }
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     TreeNode emptyNode = new TreeNode();
 | ||
|                     emptyNode.Text = "";
 | ||
|                     emptyNode.NodeID = "";
 | ||
|                     newCnProfessionNode.Nodes.Add(emptyNode);
 | ||
|                 }
 | ||
|             }
 | ||
| 
 | ||
|             if (delNode != null)
 | ||
|             {
 | ||
|                 if (!string.IsNullOrEmpty(delNode.ParentNode.NodeID))
 | ||
|                 {
 | ||
|                     if (type == "cnProfession" || type == "unitProject")
 | ||
|                     {
 | ||
|                         this.hdSelectId.Text = delNode.ParentNode.NodeID;
 | ||
|                         delNode.ParentNode.Expanded = true;
 | ||
| 
 | ||
|                     }
 | ||
|                 }
 | ||
|             }
 | ||
|             delNode = null;
 | ||
|             this.trWBS.SelectedNodeID = this.hdSelectId.Text;
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
|             BindGrid();
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #region 编辑
 | ||
|         /// <summary>
 | ||
|         /// 编辑按钮
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         protected void btnMenuModify_Click(object sender, EventArgs e)
 | ||
|         {
 | ||
|             if (Grid1.SelectedRowIndexArray.Length == 0)
 | ||
|             {
 | ||
|                 Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
 | ||
|                 return;
 | ||
|             }
 | ||
|             PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("CostControlInitEdit.aspx?type=modify&Id={0}&Code={1}", this.Grid1.SelectedRowID,this.trWBS.SelectedNodeID, "修改 - ")));
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         #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;
 | ||
|             }
 | ||
|             Model.WBS_CostControlInit costControl = BLL.CostControlInitService.GetCostControlInitByCostControlInitId(Grid1.SelectedRowID);
 | ||
|             if (costControl != null)
 | ||
|             {
 | ||
|                 BLL.WbsSetMatchCostControlInitService.DeleteWbsSetMatchCostControlInitByWbsSetCodeAndCostControlInitCode(this.trWBS.SelectedNodeID,costControl.CostControlInitCode);
 | ||
|                 BLL.CostControlInitService.DeleteCostControlInit(Grid1.SelectedRowID);
 | ||
|                 BLL.LogService.AddSys_Log(this.CurrUser, Grid1.SelectedRowID, Grid1.SelectedRowID, BLL.Const.ProjectControlPointMenuId, "删除费用对应关系");
 | ||
|                 Grid1.DataBind();
 | ||
|                 BindGrid();
 | ||
|                 Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
|     }
 | ||
| } |