2021-04-30 10:28:37 +08:00
using BLL ;
using Newtonsoft.Json.Linq ;
using System ;
using System.Collections.Generic ;
using System.Data ;
2021-08-13 11:15:59 +08:00
using System.Data.SqlClient ;
2021-04-30 10:28:37 +08:00
using System.Linq ;
using System.Web.UI.WebControls ;
namespace FineUIPro.Web.JDGL.WBS
{
public partial class WBSSetAudit : PageBase
{
#region 页 面 加 载
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
GetButtonPower ( ) ;
InitTreeMenu ( ) ;
}
2021-08-13 11:15:59 +08:00
}
2021-04-30 10:28:37 +08:00
/// <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 ;
2021-10-22 10:10:15 +08:00
//var project = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId);
//if (project != null)
//{
// TreeNode rootNode = new TreeNode();
// rootNode.Text = project.ProjectName;
// rootNode.NodeID = project.ProjectId;
// rootNode.CommandName = "project";
// rootNode.EnableExpandEvent = true;
// rootNode.EnableCheckBox = false;
// this.trWBS.Nodes.Add(rootNode);
// if (BLL.Project_InstallationService.IsExitProjectInstallation(project.ProjectId))
// {
// TreeNode emptyNode = new TreeNode();
// emptyNode.Text = "";
// emptyNode.NodeID = "";
// rootNode.Nodes.Add(emptyNode);
// }
//}
Model . Project_Installation installation = BLL . Project_InstallationService . GetProjectInstallationByProjectId ( this . CurrUser . LoginProjectId ) ;
2021-12-21 16:10:02 +08:00
if ( installation ! = null )
2021-04-30 10:28:37 +08:00
{
2021-10-22 10:10:15 +08:00
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = "[" + installation . InstallationCode + "]" + installation . InstallationName ;
newNode . NodeID = installation . InstallationId ;
newNode . CommandName = "installation" ;
newNode . EnableExpandEvent = true ;
newNode . EnableClickEvent = true ;
newNode . EnableCheckBox = false ;
this . trWBS . Nodes . Add ( newNode ) ;
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
#endregion
#region 树 节 点 展 开
/// <summary>
/// 树节点展开
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trWBS_NodeExpand ( object sender , TreeNodeEventArgs e )
{
e . Node . Nodes . Clear ( ) ;
bool needAddTempNode = false ; //是否需要增加空节点
if ( e . Node . CommandName = = "project" ) //展开项目节点
{
var installations = from x in Funs . DB . Project_Installation
where x . ProjectId = = e . Node . NodeID & & x . SuperInstallationId = = "0"
orderby x . InstallationCode
select x ;
foreach ( var installation in installations )
{
TreeNode newNode = new TreeNode ( ) ;
2021-10-22 10:10:15 +08:00
newNode . Text = "[" + installation . InstallationCode + "]" + installation . InstallationName ;
2021-04-30 10:28:37 +08:00
newNode . NodeID = installation . InstallationId ;
newNode . CommandName = "installation" ;
newNode . EnableExpandEvent = true ;
newNode . EnableClickEvent = true ;
2021-09-23 14:45:21 +08:00
newNode . EnableCheckBox = false ;
2021-04-30 10:28:37 +08:00
e . Node . Nodes . Add ( newNode ) ;
2021-08-13 11:15:59 +08:00
2021-04-30 10:28:37 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
2021-08-13 11:15:59 +08:00
newNode . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
else if ( e . Node . CommandName = = "installation" ) //展开装置/单元节点
{
var installations = from x in Funs . DB . Project_Installation
where x . SuperInstallationId = = e . Node . NodeID
orderby x . InstallationCode
select x ;
if ( installations . Count ( ) > 0 )
{
foreach ( var installation in installations )
{
TreeNode newNode = new TreeNode ( ) ;
2021-10-22 10:10:15 +08:00
newNode . Text = "[" + installation . InstallationCode + "]" + installation . InstallationName ;
2021-04-30 10:28:37 +08:00
newNode . NodeID = installation . InstallationId ;
newNode . CommandName = "installation" ;
newNode . EnableExpandEvent = true ;
newNode . EnableClickEvent = true ;
2021-09-23 14:45:21 +08:00
newNode . EnableCheckBox = false ;
2021-04-30 10:28:37 +08:00
e . Node . Nodes . Add ( newNode ) ;
2021-08-13 11:15:59 +08:00
2021-04-30 10:28:37 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
2021-08-13 11:15:59 +08:00
newNode . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
else
{
var cnProfessions = from x in Funs . DB . WBS_CnProfession where x . InstallationId = = e . Node . NodeID orderby x . OldId select x ;
if ( cnProfessions . Count ( ) > 0 ) //普通装置主项
{
foreach ( var cnProfession in cnProfessions )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = cnProfession . CnProfessionName ;
newNode . NodeID = cnProfession . CnProfessionId ;
newNode . CommandName = "cnProfession" ;
newNode . EnableExpandEvent = true ;
newNode . EnableClickEvent = true ;
2021-09-23 14:45:21 +08:00
newNode . EnableCheckBox = false ;
2021-04-30 10:28:37 +08:00
e . Node . Nodes . Add ( newNode ) ;
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
else //总图
{
var unitProjects = from x in Funs . DB . Wbs_UnitProject where x . InstallationId = = e . Node . NodeID & & x . SuperUnitProjectId = = null orderby x . SortIndex , x . UnitProjectCode select x ;
foreach ( var unitProject in unitProjects )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = unitProject . UnitProjectName ;
newNode . NodeID = unitProject . UnitProjectId ;
newNode . CommandName = "unitProject" ;
newNode . EnableExpandEvent = true ;
2021-09-23 14:45:21 +08:00
newNode . EnableCheckBox = false ;
2021-04-30 10:28:37 +08:00
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
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 = = "cnProfession" ) //展开专业节点
{
var unitProjects = from x in Funs . DB . Wbs_UnitProject where x . CnProfessionId = = e . Node . NodeID & & x . SuperUnitProjectId = = null orderby x . SortIndex , x . UnitProjectCode select x ;
foreach ( var unitProject in unitProjects )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = unitProject . UnitProjectName ;
newNode . NodeID = unitProject . UnitProjectId ;
newNode . CommandName = "unitProject" ;
newNode . EnableExpandEvent = true ;
2021-09-29 21:27:57 +08:00
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
2021-04-30 10:28:37 +08:00
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
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" ) //展开单位工程节点
{
2021-08-13 11:15:59 +08:00
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = e . Node . NodeID & & x . SuperWbsSetId = = null orderby x . WbsSetCode select x ;
if ( wbsSet1s . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
foreach ( var wbsSet1 in wbsSet1s )
2021-04-30 10:28:37 +08:00
{
TreeNode newNode = new TreeNode ( ) ;
2021-08-13 11:15:59 +08:00
newNode . Text = wbsSet1 . WbsSetName ;
newNode . NodeID = wbsSet1 . WbsSetId ;
newNode . CommandName = "wbsSet" ;
2021-04-30 10:28:37 +08:00
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
2021-08-13 11:15:59 +08:00
if ( wbsSet1 . IsSelected = = true & & wbsSet1 . IsApprove = = null )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
wbsSet1 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
if ( wbsSet1 . IsApprove = = true )
2021-04-30 10:28:37 +08:00
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
e . Node . Nodes . Add ( newNode ) ;
2021-08-13 11:15:59 +08:00
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet1 . WbsSetId ) ;
if ( wbsSets . Count > 0 )
2021-04-30 10:28:37 +08:00
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
2021-08-13 11:15:59 +08:00
//needAddTempNode = false;
//var wbsSets = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(wbsSet1.WbsSetId);
//foreach (var wbsSet in wbsSets)
//{
// var childWbsSets = from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == wbsSet.WbsSetId select x;
// if (childWbsSets.Count() > 0)
// {
// needAddTempNode = true;
// break;
// }
//}
//if (needAddTempNode)
//{
// TreeNode emptyNode = new TreeNode();
// emptyNode.Text = "";
// emptyNode.NodeID = "";
// newNode.Nodes.Add(emptyNode);
//}
2021-04-30 10:28:37 +08:00
}
}
}
else if ( e . Node . CommandName = = "wbsSet" ) //展开分部/子分部/分项/子分项工程节点
{
var childWbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( e . Node . NodeID ) ;
foreach ( var wbsSet in childWbsSets )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = wbsSet . WbsSetName ;
newNode . NodeID = wbsSet . WbsSetId ;
newNode . CommandName = "wbsSet" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( wbsSet . IsSelected = = true & & wbsSet . IsApprove = = null )
{
wbsSet . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
}
if ( wbsSet . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
e . Node . Nodes . Add ( newNode ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet . WbsSetId ) ;
2021-08-13 11:15:59 +08:00
if ( wbsSets . Count > 0 )
2021-04-30 10:28:37 +08:00
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
2021-08-13 11:15:59 +08:00
//needAddTempNode = false;
//var wbsSets = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(wbsSet.WbsSetId);
//foreach (var wbsSetc in wbsSets)
//{
// var childWbsSets1 = from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == wbsSetc.WbsSetId select x;
// if (childWbsSets1.Count() > 0)
// {
// needAddTempNode = true;
// break;
// }
//}
//if (needAddTempNode)
//{
// TreeNode emptyNode = new TreeNode();
// emptyNode.Text = "";
// emptyNode.NodeID = "";
// newNode.Nodes.Add(emptyNode);
//}
2021-04-30 10:28:37 +08:00
}
}
}
#endregion
#region 树 节 点 复 选 框 勾 选 事 件
/// <summary>
/// 树节点复选框勾选事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trWBS_NodeCheck ( object sender , FineUIPro . TreeCheckEventArgs e )
{
2021-09-23 14:45:21 +08:00
foreach ( var node in e . Node . Nodes )
{
node . Checked = e . Checked ;
Model . Wbs_WbsSet childWbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( node . NodeID ) ;
if ( childWbsSet ! = null )
{
childWbsSet . IsSelected = e . Checked ;
childWbsSet . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( childWbsSet ) ;
2021-09-29 21:27:57 +08:00
foreach ( var node2 in node . Nodes )
{
node2 . Checked = e . Checked ;
Model . Wbs_WbsSet childWbsSet2 = BLL . WbsSetService . GetWbsSetByWbsSetId ( node2 . NodeID ) ;
if ( childWbsSet2 ! = null )
{
childWbsSet2 . IsSelected = e . Checked ;
childWbsSet2 . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( childWbsSet2 ) ;
}
}
2021-09-23 14:45:21 +08:00
}
}
bool b = true ; //是否对父级节点执行选中状态的更新操作
2021-08-13 11:15:59 +08:00
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( e . NodeID ) ;
if ( wbsSet ! = null )
{
wbsSet . IsSelected = e . Checked ;
wbsSet . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
2021-09-23 14:45:21 +08:00
if ( e . Checked = = false ) //当节点取消选中时,判断是否需要对父级节点执行选中状态的更新操作
2021-08-13 11:15:59 +08:00
{
2021-09-23 14:45:21 +08:00
if ( BLL . WbsSetService . IsExitOtherApproveWbsSetsBySuperWbsSetId ( wbsSet . SuperWbsSetId , wbsSet . WbsSetId ) )
2021-08-13 11:15:59 +08:00
{
2021-09-23 14:45:21 +08:00
b = false ;
2021-08-13 11:15:59 +08:00
}
}
2021-09-23 14:45:21 +08:00
if ( b )
2021-04-30 10:28:37 +08:00
{
2021-09-23 14:45:21 +08:00
Model . Wbs_WbsSet pWbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( wbsSet . SuperWbsSetId ) ;
if ( pWbsSet ! = null )
{
if ( e . Node . ParentNode . EnableCheckBox = = true )
{
e . Node . ParentNode . Checked = e . Checked ;
}
pWbsSet . IsSelected = e . Checked ;
pWbsSet . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( pWbsSet ) ;
Model . Wbs_WbsSet ppWbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( pWbsSet . SuperWbsSetId ) ;
if ( ppWbsSet ! = null )
{
if ( e . Node . ParentNode . ParentNode . EnableCheckBox = = true )
{
e . Node . ParentNode . ParentNode . Checked = e . Checked ;
}
ppWbsSet . IsSelected = e . Checked ;
ppWbsSet . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( ppWbsSet ) ;
Model . Wbs_WbsSet pppWbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( ppWbsSet . SuperWbsSetId ) ;
if ( pppWbsSet ! = null )
{
if ( e . Node . ParentNode . ParentNode . ParentNode . EnableCheckBox = = true )
{
e . Node . ParentNode . ParentNode . ParentNode . Checked = e . Checked ;
}
pppWbsSet . IsSelected = e . Checked ;
pppWbsSet . IsApprove = e . Checked ;
BLL . WbsSetService . UpdateWbsSet ( pppWbsSet ) ;
}
}
}
2021-09-29 21:27:57 +08:00
TreeNode unitProjectNode = null ;
if ( e . Node . ParentNode . CommandName = = "unitProject" )
2021-09-23 14:45:21 +08:00
{
2021-09-29 21:27:57 +08:00
unitProjectNode = e . Node . ParentNode ;
}
else if ( e . Node . ParentNode . ParentNode . CommandName = = "unitProject" )
{
unitProjectNode = e . Node . ParentNode . ParentNode ;
2021-09-23 14:45:21 +08:00
}
2021-09-29 21:27:57 +08:00
else if ( e . Node . ParentNode . ParentNode . ParentNode . CommandName = = "unitProject" )
2021-09-23 14:45:21 +08:00
{
2021-09-29 21:27:57 +08:00
unitProjectNode = e . Node . ParentNode . ParentNode . ParentNode ;
}
//选择否时,对单位工程节点选中状态的判断
List < Model . Wbs_WbsSet > approveWbsSets = BLL . WbsSetService . GetApproveWbsSetsByUnitProjectId ( wbsSet . UnitProjectId ) ;
if ( e . Checked = = true | | ( e . Checked = = false & & approveWbsSets . Count = = 0 ) )
{
unitProjectNode . Checked = e . Checked ;
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( wbsSet . UnitProjectId ) ;
if ( unitProject ! = null )
{
unitProject . IsSelected = e . Checked ;
unitProject . IsApprove = e . Checked ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
Model . WBS_CnProfession cnProfession = BLL . CnProfessionService . GetCnProfessionByCnProfessionId ( wbsSet . CnProfessionId ) ;
if ( cnProfession ! = null )
{
cnProfession . IsSelected = e . Checked ;
cnProfession . IsApprove = e . Checked ;
BLL . CnProfessionService . UpdateCnProfession ( cnProfession ) ;
}
2021-09-23 14:45:21 +08:00
}
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
}
2021-09-29 21:27:57 +08:00
else
{
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( e . NodeID ) ;
if ( unitProject ! = null )
{
unitProject . IsSelected = e . Checked ;
unitProject . IsApprove = e . Checked ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
Model . WBS_CnProfession cnProfession = BLL . CnProfessionService . GetCnProfessionByCnProfessionId ( unitProject . CnProfessionId ) ;
if ( cnProfession ! = null )
{
2023-07-05 17:58:52 +08:00
if ( e . Checked = = false )
{
var selectedUnitProject = Funs . DB . Wbs_UnitProject . FirstOrDefault ( x = > x . CnProfessionId = = cnProfession . CnProfessionId & & x . IsSelected = = true ) ;
if ( selectedUnitProject ! = null )
{
}
else
{
cnProfession . IsSelected = e . Checked ;
cnProfession . IsApprove = e . Checked ;
}
}
else
{
cnProfession . IsSelected = e . Checked ;
cnProfession . IsApprove = e . Checked ;
}
2021-09-29 21:27:57 +08:00
BLL . CnProfessionService . UpdateCnProfession ( cnProfession ) ;
}
}
2021-08-13 11:15:59 +08:00
//if (e.Checked)
//{
// CheckAllParentNodes(e.Node);
// CheckAllChildNodes(e.Node);
// this.UpdateSelect(e.Node, true);
2021-04-30 10:28:37 +08:00
//}
//else
//{
2021-08-13 11:15:59 +08:00
// if (auditText == string.Empty)
// {
// trWBS.UncheckAllNodes(e.Node.Nodes);
// this.UpdateSelect(e.Node, false);
// }
// else
// {
// auditText = auditText.Substring(0, auditText.Length - 1);
// e.Node.Checked = true;
// ShowNotify("权重已有设置审核项:'" + auditText + "',不能取消设置!", MessageBoxIcon.Success);
// }
2021-04-30 10:28:37 +08:00
//}
2021-08-13 11:15:59 +08:00
BindGrid ( ) ;
2021-04-30 10:28:37 +08:00
}
private void CheckAllParentNodes ( TreeNode node )
{
if ( node . ParentNode ! = null )
{
node . ParentNode . Checked = true ;
CheckAllParentNodes ( node . ParentNode ) ;
}
}
private void CheckAllChildNodes ( TreeNode node )
{
trWBS . CheckAllNodes ( node . Nodes ) ;
foreach ( TreeNode tn in node . Nodes )
{
if ( tn . Nodes . Count ( ) > 0 )
{
CheckAllChildNodes ( tn ) ;
}
}
}
private string auditText = string . Empty ;
/// <summary>
/// 反向选择时判断是否有设置权重的项
/// </summary>
/// <param name="node"></param>
/// <param name="isSelected"></param>
private void IsAuditUnSelect ( TreeNode node )
{
if ( node . CommandName = = "unitProject" | | node . CommandName = = "childUnitProject" )
{
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . NodeID ) ;
if ( unitProject ! = null )
{
if ( unitProject . IsWeightsApprove = = true )
{
auditText = auditText + unitProject . UnitProjectName + "," ;
}
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . IsAuditUnSelect ( childNode ) ;
}
}
}
}
else
{
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( node . NodeID ) ;
if ( wbsSet ! = null )
{
if ( wbsSet . IsWeightsApprove = = true )
{
auditText = auditText + wbsSet . WbsSetName + "," ;
}
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . IsAuditUnSelect ( childNode ) ;
}
}
}
}
}
/// <summary>
/// 循环更新选择状态
/// </summary>
/// <param name="node"></param>
/// <param name="isSelected"></param>
private void UpdateSelect ( TreeNode node , bool isSelected )
{
2021-08-13 11:15:59 +08:00
if ( node . CommandName = = "unitProject" )
2021-04-30 10:28:37 +08:00
{
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . NodeID ) ;
if ( unitProject ! = null )
{
unitProject . IsSelected = isSelected ;
unitProject . IsApprove = isSelected ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . UpdateSelect ( childNode , isSelected ) ;
}
}
else //末级节点更新其子项状态
{
var wbsSets = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = node . NodeID select x ;
foreach ( var wbsSet in wbsSets )
{
wbsSet . IsSelected = isSelected ;
wbsSet . IsApprove = isSelected ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
}
}
UpdateParentSelect ( node , isSelected ) ;
}
}
else
{
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( node . NodeID ) ;
if ( wbsSet ! = null )
{
wbsSet . IsSelected = isSelected ;
wbsSet . IsApprove = isSelected ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . UpdateSelect ( childNode , isSelected ) ;
}
}
else //末级节点更新其子项状态
{
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . SuperWbsSetId = = node . NodeID select x ;
foreach ( var wbsSet1 in wbsSet1s )
{
wbsSet1 . IsSelected = isSelected ;
wbsSet1 . IsApprove = isSelected ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
}
}
UpdateParentSelect ( node , isSelected ) ;
}
}
}
/// <summary>
/// 循环更新父级选择状态
/// </summary>
/// <param name="node"></param>
/// <param name="isSelected"></param>
private void UpdateParentSelect ( TreeNode node , bool isSelected )
{
if ( node . CommandName = = "childUnitProject" )
{
Model . Wbs_UnitProject parentUnitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . ParentNode . NodeID ) ;
if ( parentUnitProject ! = null )
{
parentUnitProject . IsSelected = isSelected ;
parentUnitProject . IsApprove = isSelected ;
BLL . UnitProjectService . UpdateUnitProject ( parentUnitProject ) ;
}
}
else if ( node . CommandName = = "wbsSet" )
{
if ( node . ParentNode . CommandName = = "wbsSet" )
{
Model . Wbs_WbsSet parentWbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( node . ParentNode . NodeID ) ;
if ( parentWbsSet ! = null )
{
parentWbsSet . IsSelected = isSelected ;
parentWbsSet . IsApprove = isSelected ;
BLL . WbsSetService . UpdateWbsSet ( parentWbsSet ) ;
UpdateParentSelect ( node . ParentNode , isSelected ) ;
}
}
else if ( node . ParentNode . CommandName = = "childUnitProject" )
{
Model . Wbs_UnitProject parentUnitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . ParentNode . NodeID ) ;
if ( parentUnitProject ! = null )
{
parentUnitProject . IsSelected = isSelected ;
parentUnitProject . IsApprove = isSelected ;
BLL . UnitProjectService . UpdateUnitProject ( parentUnitProject ) ;
UpdateParentSelect ( node . ParentNode , isSelected ) ;
}
}
else if ( node . ParentNode . CommandName = = "unitProject" )
{
Model . Wbs_UnitProject parentUnitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . ParentNode . NodeID ) ;
if ( parentUnitProject ! = null )
{
parentUnitProject . IsSelected = isSelected ;
parentUnitProject . IsApprove = isSelected ;
BLL . UnitProjectService . UpdateUnitProject ( parentUnitProject ) ;
}
}
}
}
/// <summary>
/// 循环更新选择状态
/// </summary>
/// <param name="node"></param>
/// <param name="isSelected"></param>
private void UpdateSelect ( TreeNode node )
{
if ( node . CommandName = = "unitProject" | | node . CommandName = = "childUnitProject" )
{
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( node . NodeID ) ;
if ( unitProject ! = null )
{
if ( node . Checked )
{
unitProject . IsSelected = true ;
unitProject . IsApprove = true ;
}
else
{
unitProject . IsSelected = null ;
unitProject . IsApprove = null ;
}
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . UpdateSelect ( childNode ) ;
}
}
}
}
else
{
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( node . NodeID ) ;
if ( wbsSet ! = null )
{
if ( node . Checked )
{
wbsSet . IsSelected = true ;
wbsSet . IsApprove = true ;
}
else
{
wbsSet . IsSelected = null ;
wbsSet . IsApprove = null ;
}
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
if ( ! node . Leaf )
{
foreach ( var childNode in node . Nodes )
{
this . UpdateSelect ( childNode ) ;
}
}
}
}
}
#endregion
#region Tree点击事件
/// <summary>
/// Tree点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trWBS_NodeCommand ( object sender , TreeCommandEventArgs e )
{
BindGrid ( ) ;
}
#endregion
2021-08-13 11:15:59 +08:00
#region 导 出 焊 口 信 息
/// <summary>
/// 导出焊口信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click ( object sender , EventArgs e )
{
PageContext . RegisterStartupScript ( Window3 . GetShowReference ( String . Format ( "WBSOut.aspx" , "导出 - " ) ) ) ;
}
#endregion
#region 导 入
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click ( object sender , EventArgs e )
{
PageContext . RegisterStartupScript ( Window3 . GetShowReference ( String . Format ( "WBSIn.aspx" , "导入 - " ) ) ) ;
}
#endregion
#region 修 改 关 闭 窗 口
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close ( object sender , WindowCloseEventArgs e )
{
2022-04-20 17:24:24 +08:00
ShowNotify ( "保存成功!" , MessageBoxIcon . Success ) ;
UpdateTree ( ) ;
//getWBSSet();
2021-08-13 11:15:59 +08:00
}
#endregion
2022-04-20 17:24:24 +08:00
private void UpdateTree ( )
{
if ( this . hdType . Text = = "add" )
{
this . trWBS . SelectedNode . Nodes . Clear ( ) ;
if ( this . trWBS . SelectedNode . CommandName = = "cnProfession" )
{
var unitProjects = from x in Funs . DB . Wbs_UnitProject where x . CnProfessionId = = this . trWBS . SelectedNode . NodeID & & x . SuperUnitProjectId = = null orderby x . SortIndex , x . UnitProjectCode select x ;
foreach ( var unitProject in unitProjects )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = unitProject . UnitProjectName ;
newNode . NodeID = unitProject . UnitProjectId ;
newNode . CommandName = "unitProject" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
this . trWBS . SelectedNode . Nodes . Add ( newNode ) ;
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
else if ( this . trWBS . SelectedNode . CommandName = = "unitProject" )
{
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = this . trWBS . SelectedNode . NodeID & & x . SuperWbsSetId = = 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 . WbsSetId ;
newNode . CommandName = "wbsSet" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( wbsSet1 . IsSelected = = true & & wbsSet1 . IsApprove = = null )
{
wbsSet1 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
}
if ( wbsSet1 . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
this . trWBS . SelectedNode . Nodes . Add ( newNode ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet1 . WbsSetId ) ;
if ( wbsSets . Count > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
}
}
else if ( this . trWBS . SelectedNode . CommandName = = "wbsSet" )
{
var childWbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( this . trWBS . SelectedNode . NodeID ) ;
foreach ( var wbsSet in childWbsSets )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = wbsSet . WbsSetName ;
newNode . NodeID = wbsSet . WbsSetId ;
newNode . CommandName = "wbsSet" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( wbsSet . IsSelected = = true & & wbsSet . IsApprove = = null )
{
wbsSet . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
}
if ( wbsSet . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
this . trWBS . SelectedNode . Nodes . Add ( newNode ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet . WbsSetId ) ;
if ( wbsSets . Count > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
}
}
else if ( this . hdType . Text = = "modify" | | this . hdType . Text = = "del" | | this . hdType . Text = = "copy" )
{
var node = this . trWBS . SelectedNode . ParentNode ;
this . trWBS . SelectedNode . ParentNode . Nodes . Clear ( ) ;
if ( node . CommandName = = "cnProfession" )
{
var unitProjects = from x in Funs . DB . Wbs_UnitProject where x . CnProfessionId = = node . NodeID & & x . SuperUnitProjectId = = null orderby x . SortIndex , x . UnitProjectCode select x ;
foreach ( var unitProject in unitProjects )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = unitProject . UnitProjectName ;
newNode . NodeID = unitProject . UnitProjectId ;
newNode . CommandName = "unitProject" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
node . Nodes . Add ( newNode ) ;
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
else if ( node . CommandName = = "unitProject" )
{
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = node . NodeID & & x . SuperWbsSetId = = 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 . WbsSetId ;
newNode . CommandName = "wbsSet" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( wbsSet1 . IsSelected = = true & & wbsSet1 . IsApprove = = null )
{
wbsSet1 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
}
if ( wbsSet1 . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
node . Nodes . Add ( newNode ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet1 . WbsSetId ) ;
if ( wbsSets . Count > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
}
}
else if ( node . CommandName = = "wbsSet" )
{
var childWbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( node . NodeID ) ;
foreach ( var wbsSet in childWbsSets )
{
TreeNode newNode = new TreeNode ( ) ;
newNode . Text = wbsSet . WbsSetName ;
newNode . NodeID = wbsSet . WbsSetId ;
newNode . CommandName = "wbsSet" ;
newNode . EnableExpandEvent = true ;
newNode . EnableCheckBox = true ;
newNode . EnableCheckEvent = true ;
if ( wbsSet . IsSelected = = true & & wbsSet . IsApprove = = null )
{
wbsSet . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
}
if ( wbsSet . IsApprove = = true )
{
newNode . Checked = true ;
}
else
{
newNode . Checked = false ;
}
newNode . EnableClickEvent = true ;
node . Nodes . Add ( newNode ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet . WbsSetId ) ;
if ( wbsSets . Count > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNode . Nodes . Add ( emptyNode ) ;
}
}
}
}
}
2021-08-13 11:15:59 +08:00
#region 关 闭 窗 口
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window2_Close ( object sender , WindowCloseEventArgs e )
{
ShowNotify ( "拷贝成功!" , MessageBoxIcon . Success ) ;
2022-04-20 17:24:24 +08:00
UpdateTree ( ) ;
//getWBSSet();
2021-08-13 11:15:59 +08:00
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window3_Close ( object sender , WindowCloseEventArgs e )
{
ShowNotify ( "保存成功!" , MessageBoxIcon . Success ) ;
BindGrid ( ) ;
}
#endregion
#region 右 键 增 加 、 修 改 、 拷 贝 、 删 除 方 法
2021-04-30 10:28:37 +08:00
/// <summary>
2021-08-13 11:15:59 +08:00
/// 增加费控项
2021-04-30 10:28:37 +08:00
/// </summary>
2021-08-13 11:15:59 +08:00
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAdd_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
if ( ! string . IsNullOrEmpty ( trWBS . SelectedNodeID ) )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
this . hdSelectId . Text = this . trWBS . SelectedNodeID ;
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( this . trWBS . SelectedNodeID ) ;
if ( wbsSet ! = null )
{
var list = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( this . trWBS . SelectedNodeID ) ;
if ( list . Count = = 0 )
{
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 ) ;
}
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
}
2021-04-30 10:28:37 +08:00
2021-08-13 11:15:59 +08:00
/// <summary>
/// 右键增加事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuAdd_Click ( object sender , EventArgs e )
{
if ( this . trWBS . SelectedNode ! = null )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetAuditMenuId, BLL.Const.BtnAdd))
//{
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" ) //非项目、装置节点可以增加
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
this . hdType . Text = "add" ;
2021-08-13 11:15:59 +08:00
string window = String . Format ( "WBSSetAuditEdit.aspx?Id={0}&Type={1}&oper=add" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "编辑 - " ) ;
PageContext . RegisterStartupScript ( Window1 . GetSaveStateReference ( hdSelectId . ClientID ) + Window1 . GetShowReference ( window ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else
{
if ( this . trWBS . SelectedNode . Text = = "总图" )
{
2022-04-20 17:24:24 +08:00
this . hdType . Text = "add" ;
2021-08-13 11:15:59 +08:00
string window = String . Format ( "WBSSetAuditEdit.aspx?Id={0}&Type={1}&oper=add" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "编辑 - " ) ;
PageContext . RegisterStartupScript ( Window1 . GetSaveStateReference ( hdSelectId . ClientID ) + Window1 . GetShowReference ( window ) ) ;
}
else
{
ShowNotify ( "项目、装置节点无法修改!" , MessageBoxIcon . Warning ) ;
}
}
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
}
else
{
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
}
/// <summary>
/// 右键修改事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click ( object sender , EventArgs e )
{
if ( this . trWBS . SelectedNode ! = null )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetAuditMenuId, BLL.Const.BtnModify))
//{
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" ) //非项目、装置节点可以修改
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
this . hdType . Text = "modify" ;
2021-08-13 11:15:59 +08:00
this . hdSelectId . Text = this . trWBS . SelectedNode . NodeID ;
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WBSSetAuditEdit.aspx?Id={0}&Type={1}&oper=modify" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "编辑 - " ) ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
if ( this . trWBS . SelectedNode . Text = = "总图" )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
this . hdType . Text = "modify" ;
2021-08-13 11:15:59 +08:00
this . hdSelectId . Text = this . trWBS . SelectedNode . NodeID ;
PageContext . RegisterStartupScript ( Window1 . GetShowReference ( String . Format ( "WBSSetAuditEdit.aspx?Id={0}&Type={1}&oper=modify" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "编辑 - " ) ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
ShowNotify ( "项目、装置节点无法修改!" , MessageBoxIcon . Warning ) ;
2021-04-30 10:28:37 +08:00
}
}
2021-08-13 11:15:59 +08:00
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
2021-04-30 10:28:37 +08:00
}
}
/// <summary>
2021-08-13 11:15:59 +08:00
/// 编辑按钮
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuModify_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
PageContext . RegisterStartupScript ( Window3 . GetShowReference ( String . Format ( "CostControlEdit.aspx?type=modify&Id={0}&Code={1}" , this . Grid1 . SelectedRowID , this . trWBS . SelectedNodeID , "修改 - " ) ) ) ;
2021-04-30 10:28:37 +08:00
}
/// <summary>
2021-08-13 11:15:59 +08:00
/// 设置计划按钮
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuDetail_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
PageContext . RegisterStartupScript ( Window4 . GetShowReference ( String . Format ( "CostControlDetailEdit.aspx?Id={0}" , this . Grid1 . SelectedRowID , "修改 - " ) ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-09-15 14:50:52 +08:00
/// <summary>
/// 设置周计划按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuWeekDetail_Click ( object sender , EventArgs e )
{
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
{
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
}
PageContext . RegisterStartupScript ( Window4 . GetShowReference ( String . Format ( "CostControlWeekDetailEdit.aspx?Id={0}" , this . Grid1 . SelectedRowID , "修改 - " ) ) ) ;
}
2021-04-30 10:28:37 +08:00
/// <summary>
2021-08-13 11:15:59 +08:00
/// 拷贝
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuCopy_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
if ( this . trWBS . SelectedNode ! = null )
{
2021-08-13 11:15:59 +08:00
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" & & this . trWBS . SelectedNode . CommandName ! = "cnProfession" & & this . trWBS . SelectedNode . CommandName ! = "unitProject" ) //非项目、装置、专业、单位工程节点可以拷贝
{
2022-04-20 17:24:24 +08:00
this . hdType . Text = "copy" ;
2021-08-13 11:15:59 +08:00
string openUrl = String . Format ( "WBSSetCopy.aspx?Id={0}&Type={1}" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "拷贝 - " ) ;
PageContext . RegisterStartupScript ( Window2 . GetSaveStateReference ( hdSelectId . ClientID )
+ Window2 . GetShowReference ( openUrl ) ) ;
//var wbsSet1s = from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == this.trWBS.SelectedNodeID select x;
//bool isCanCopy = true; //分部分项下只有一级子级时可以拷贝
//foreach (var wbsSet1 in wbsSet1s)
//{
// var wbsSet2s = from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == wbsSet1.WbsSetId select x;
// if (wbsSet2s.Count() > 0)
// {
// isCanCopy = false;
// break;
// }
//}
//if (isCanCopy)
//{
// string openUrl = String.Format("WBSSetCopy.aspx?Id={0}&Type={1}", this.trWBS.SelectedNode.NodeID, this.trWBS.SelectedNode.CommandName, "拷贝 - ");
// PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
// + Window2.GetShowReference(openUrl));
//}
//else
//{
// bool isCopyed = false; //是否拷贝过
// foreach (var wbsSet1 in wbsSet1s)
// {
// if (wbsSet1.NoShow == true)
// {
// isCopyed = true;
// break;
// }
// }
// if (isCopyed)
// {
// string openUrl = String.Format("WBSSetCopy.aspx?Id={0}&Type={1}", this.trWBS.SelectedNode.NodeID, this.trWBS.SelectedNode.CommandName, "拷贝 - ");
// PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
// + Window2.GetShowReference(openUrl));
// }
// else
// {
// ShowNotify("所选节点并非只有一级子级,无法拷贝!", MessageBoxIcon.Warning);
// }
//}
}
else
{
ShowNotify ( "项目、装置、专业和单位工程节点无法拷贝!" , MessageBoxIcon . Warning ) ;
}
2021-04-30 10:28:37 +08:00
}
else
{
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
}
}
/// <summary>
2021-08-13 11:15:59 +08:00
/// 分级
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuCopy2_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
if ( this . trWBS . SelectedNode ! = null )
{
2021-08-13 11:15:59 +08:00
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectWBSSetAuditMenuId, BLL.Const.BtnAdd))
2021-04-30 10:28:37 +08:00
//{
2021-08-13 11:15:59 +08:00
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" & & this . trWBS . SelectedNode . CommandName ! = "cnProfession" & & this . trWBS . SelectedNode . CommandName ! = "unitProject" ) //非项目、装置、专业、单位工程节点可以拷贝
{
if ( this . trWBS . SelectedNode . CommandName = = "childUnitProject" )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
string openUrl = String . Format ( "WBSSetCopy2.aspx?Id={0}&Type={1}" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "分级 - " ) ;
PageContext . RegisterStartupScript ( Window2 . GetSaveStateReference ( hdSelectId . ClientID )
+ Window2 . GetShowReference ( openUrl ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
else if ( this . trWBS . SelectedNode . CommandName = = "wbsSet" )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
string openUrl = String . Format ( "WBSSetCopy2.aspx?Id={0}&Type={1}" , this . trWBS . SelectedNode . NodeID , this . trWBS . SelectedNode . CommandName , "分级 - " ) ;
PageContext . RegisterStartupScript ( Window2 . GetSaveStateReference ( hdSelectId . ClientID )
+ Window2 . GetShowReference ( openUrl ) ) ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
}
else
{
ShowNotify ( "项目、装置、专业和单位工程节点无法分级!" , MessageBoxIcon . Warning ) ;
}
2021-04-30 10:28:37 +08:00
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
}
else
{
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
}
}
/// <summary>
2021-08-13 11:15:59 +08:00
/// 右键删除事件
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuDelete_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
if ( this . trWBS . SelectedNode ! = null )
{
2021-08-13 11:15:59 +08:00
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectWBSSetAuditMenuId, BLL.Const.BtnAuditing))
2021-04-30 10:28:37 +08:00
//{
2021-08-13 11:15:59 +08:00
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" & & this . trWBS . SelectedNode . CommandName ! = "cnProfession" ) //非项目、装置、专业节点可以修改
{
DeleteData ( ) ;
}
else
{
ShowNotify ( "项目、装置和专业节点无法删除!" , MessageBoxIcon . Warning ) ;
}
2021-04-30 10:28:37 +08:00
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
}
else
{
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
}
}
/// <summary>
2021-08-13 11:15:59 +08:00
/// 删除
2021-04-30 10:28:37 +08:00
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2021-08-13 11:15:59 +08:00
protected void btnMenuDel_Click ( object sender , EventArgs e )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
if ( Grid1 . SelectedRowIndexArray . Length = = 0 )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
Alert . ShowInTop ( "请至少选择一条记录!" , MessageBoxIcon . Warning ) ;
return ;
2021-04-30 10:28:37 +08:00
}
2021-09-23 14:45:21 +08:00
foreach ( var id in this . Grid1 . SelectedRowIDArray )
2021-04-30 10:28:37 +08:00
{
2021-09-23 14:45:21 +08:00
Model . WBS_CostControl costControl = BLL . CostControlService . GetCostControlByCostControlId ( id ) ;
2021-08-13 11:15:59 +08:00
BLL . WbsSetMatchCostControlService . DeleteWbsSetMatchCostControlByWbsSetIdAndCostControlCode ( this . trWBS . SelectedNodeID , costControl . CostControlCode ) ;
2021-09-23 14:45:21 +08:00
BLL . CostControlService . DeleteCostControl ( id ) ;
2021-08-13 11:15:59 +08:00
Grid1 . DataBind ( ) ;
BindGrid ( ) ;
2021-04-30 10:28:37 +08:00
}
2021-09-23 14:45:21 +08:00
BLL . LogService . AddSys_Log ( this . CurrUser , Grid1 . SelectedRowID , Grid1 . SelectedRowID , BLL . Const . ProjectControlPointMenuId , "删除费用对应关系" ) ;
Alert . ShowInTop ( "删除数据成功!" , MessageBoxIcon . Success ) ;
2021-04-30 10:28:37 +08:00
}
/// <summary>
/// 删除方法
/// </summary>
private void DeleteData ( )
{
string id = this . trWBS . SelectedNodeID ;
if ( this . trWBS . SelectedNode . CommandName = = "unitProject" )
{
Model . Wbs_UnitProject unitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( id ) ;
if ( unitProject ! = null )
{
if ( unitProject . IsIn = = true )
{
ShowNotify ( "内置项无法删除!" , MessageBoxIcon . Warning ) ;
return ;
}
else
{
List < Model . Wbs_UnitProject > childUnitProjects = BLL . UnitProjectService . GetUnitProjectsBySuperUnitProjectId ( id ) ;
if ( childUnitProjects . Count > 0 ) //存在子单位工程
{
this . hdSelectId . Text = unitProject . CnProfessionId ;
foreach ( var childUnitProject in childUnitProjects )
{
BLL . WbsSetService . DeleteWbsSetByUnitProjectId ( childUnitProject . UnitProjectId ) ;
}
BLL . UnitProjectService . DeleteUnitProjectBySuperUnitProjectId ( id ) ;
BLL . UnitProjectService . DeleteUnitProject ( id ) ;
}
else
{
this . hdSelectId . Text = unitProject . CnProfessionId ;
2022-04-20 17:24:24 +08:00
var wbsSets = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = id select x ;
foreach ( var item in wbsSets )
{
BLL . CostControlService . DeleteCostControlByWbsSetId ( item . WbsSetId ) ; //删除费控项
BLL . WbsSetService . DeleteWbsSet ( item . WbsSetId ) ;
}
//BLL.WbsSetService.DeleteWbsSetByUnitProjectId(id);
2021-04-30 10:28:37 +08:00
BLL . UnitProjectService . DeleteUnitProject ( id ) ;
}
}
}
}
else if ( this . trWBS . SelectedNode . CommandName = = "childUnitProject" )
{
Model . Wbs_UnitProject childUnitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( id ) ;
if ( childUnitProject ! = null )
{
if ( childUnitProject . IsIn = = true )
{
ShowNotify ( "内置项无法删除!" , MessageBoxIcon . Warning ) ;
return ;
}
else
{
this . hdSelectId . Text = childUnitProject . SuperUnitProjectId ;
BLL . WbsSetService . DeleteWbsSetByUnitProjectId ( id ) ;
BLL . UnitProjectService . DeleteUnitProject ( id ) ;
}
}
}
else if ( this . trWBS . SelectedNode . CommandName = = "wbsSet" )
{
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( id ) ;
if ( wbsSet ! = null )
{
if ( wbsSet . IsIn = = true )
{
ShowNotify ( "内置项无法删除!" , MessageBoxIcon . Warning ) ;
return ;
}
else
{
List < Model . Wbs_WbsSet > childWbsSet1s = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( id ) ;
Model . Wbs_WbsSet set = BLL . WbsSetService . GetWbsSetByWbsSetId ( id ) ;
if ( set ! = null )
{
if ( ! string . IsNullOrEmpty ( set . SuperWbsSetId ) )
{
this . hdSelectId . Text = wbsSet . SuperWbsSetId ;
}
else
{
this . hdSelectId . Text = wbsSet . UnitProjectId ;
}
}
foreach ( var childWbsSet1 in childWbsSet1s )
{
List < Model . Wbs_WbsSet > childWbsSet2s = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( childWbsSet1 . WbsSetId ) ;
foreach ( var childWbsSet2 in childWbsSet2s ) //3
{
List < Model . Wbs_WbsSet > childWbsSet3s = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( childWbsSet2 . WbsSetId ) ;
foreach ( var childWbsSet3 in childWbsSet3s )
{
2021-08-13 11:15:59 +08:00
BLL . CostControlService . DeleteCostControlByWbsSetId ( childWbsSet3 . WbsSetId ) ; //删除费控项
2021-04-30 10:28:37 +08:00
BLL . WbsSetService . DeleteWbsSet ( childWbsSet3 . WbsSetId ) ;
}
2021-08-13 11:15:59 +08:00
BLL . CostControlService . DeleteCostControlByWbsSetId ( childWbsSet2 . WbsSetId ) ; //删除费控项
2021-04-30 10:28:37 +08:00
BLL . WbsSetService . DeleteWbsSet ( childWbsSet2 . WbsSetId ) ;
}
2021-08-13 11:15:59 +08:00
BLL . CostControlService . DeleteCostControlByWbsSetId ( childWbsSet1 . WbsSetId ) ; //删除费控项
2021-04-30 10:28:37 +08:00
BLL . WbsSetService . DeleteWbsSet ( childWbsSet1 . WbsSetId ) ;
}
2021-08-13 11:15:59 +08:00
BLL . CostControlService . DeleteCostControlByWbsSetId ( id ) ; //删除费控项
2021-04-30 10:28:37 +08:00
BLL . WbsSetService . DeleteWbsSet ( id ) ;
}
}
}
2022-04-20 17:24:24 +08:00
this . hdType . Text = "del" ;
UpdateTree ( ) ;
2021-04-30 10:28:37 +08:00
ShowNotify ( "删除成功!" , MessageBoxIcon . Success ) ;
2022-04-20 17:24:24 +08:00
//getWBSSet();
2021-04-30 10:28:37 +08:00
}
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuAudit_Click ( object sender , EventArgs e )
{
if ( this . trWBS . SelectedNode ! = null )
{
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectWBSSetAuditMenuId, BLL.Const.BtnAuditing))
////{
2021-08-13 11:15:59 +08:00
if ( this . trWBS . SelectedNode . CommandName ! = "project" & & this . trWBS . SelectedNode . CommandName ! = "installation" & & this . trWBS . SelectedNode . CommandName ! = "cnProfession" ) //非项目、装置、专业节点可以修改
{
this . UpdateSelect ( trWBS . SelectedNode ) ;
BindGrid ( ) ;
ShowNotify ( "已审核成功!" , MessageBoxIcon . Warning ) ;
}
else
{
ShowNotify ( "请选择专业下项进行审核!" , MessageBoxIcon . Warning ) ;
}
2021-04-30 10:28:37 +08:00
//}
//else
//{
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
//}
}
else
{
ShowNotify ( "请选择树节点!" , MessageBoxIcon . Warning ) ;
}
}
#endregion
#region 点 击 勾 选 按 钮
/// <summary>
/// 点击勾选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void cbIsApprove_CheckedChanged ( object sender , EventArgs e )
{
System . Web . UI . WebControls . CheckBox cbIsApprove1 = sender as System . Web . UI . WebControls . CheckBox ;
for ( int i = 0 ; i < this . Grid1 . Rows . Count ; i + + )
{
System . Web . UI . WebControls . CheckBox cbIsApprove = ( System . Web . UI . WebControls . CheckBox ) ( this . Grid1 . Rows [ i ] . FindControl ( "cbIsApprove" ) ) ;
if ( cbIsApprove1 . ClientID = = cbIsApprove . ClientID )
{
string id = this . Grid1 . Rows [ i ] . DataKeys [ 0 ] . ToString ( ) ;
Model . Wbs_WbsSet wbsSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( id ) ;
if ( cbIsApprove1 . Checked )
{
wbsSet . IsApprove = true ;
}
else
{
wbsSet . IsApprove = false ;
}
BLL . WbsSetService . UpdateWbsSet ( wbsSet ) ;
}
}
}
#endregion
#region 提 交 不 用 了
/// <summary>
/// 提交
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void btnSave1_Click(object sender, EventArgs e)
//{
// Grid1.CommitChanges();
// for (int i = 0; i < this.Grid1.Rows.Count; i++)
// {
// string id = this.Grid1.Rows[i].Values[9].ToString();
// if (id.Length > 10)
// {
// string changeDateType = this.Grid1.Rows[i].Values[10].ToString();
// string type = this.Grid1.Rows[i].Values[4].ToString();
// if (changeDateType == "StartDate")
// {
// DateTime? startDate = Convert.ToDateTime(this.Grid1.Rows[i].Values[2].ToString());
// BLL.Project_InstallationService.UpdateChildWBSDate(id, type, changeDateType, startDate);
// BLL.Project_InstallationService.UpdateParentWBSDate(id, type, changeDateType, startDate);
// }
// else if (changeDateType == "EndDate")
// {
// DateTime? endDate = Convert.ToDateTime(this.Grid1.Rows[i].Values[3].ToString());
// BLL.Project_InstallationService.UpdateChildWBSDate(id, type, changeDateType, endDate);
// BLL.Project_InstallationService.UpdateParentWBSDate(id, type, changeDateType, endDate);
// }
// else if (changeDateType == "ControlPoint")
// {
// string controlPoint = this.Grid1.Rows[i].Values[5].ToString();
// Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id);
// if (wbsSet != null)
// {
// wbsSet.ControlPoint = controlPoint;
// BLL.WbsSetService.UpdateWbsSet(wbsSet);
// }
// }
// else if (changeDateType == "Cycle")
// {
// string cycle = this.Grid1.Rows[i].Values[6].ToString();
// Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id);
// if (wbsSet != null)
// {
// wbsSet.Cycle = Funs.GetNewIntOrZero(cycle);
// BLL.WbsSetService.UpdateWbsSet(wbsSet);
// }
// }
// else if (changeDateType == "Frequency")
// {
// string frequency = this.Grid1.Rows[i].Values[7].ToString();
// Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(id);
// if (wbsSet != null)
// {
// wbsSet.Frequency = Funs.GetNewIntOrZero(frequency);
// BLL.WbsSetService.UpdateWbsSet(wbsSet);
// }
// }
// }
// }
// BindGrid();
//}
#endregion
#region 保 存 事 件
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click ( object sender , EventArgs e )
{
2021-08-13 11:15:59 +08:00
if ( Grid1 . Rows . Count > 0 )
{
JArray mergedData = Grid1 . GetMergedData ( ) ;
2021-04-30 10:28:37 +08:00
2021-08-13 11:15:59 +08:00
bool isPass = true ;
if ( isPass )
{
2021-12-21 16:10:02 +08:00
foreach ( var item in this . Grid1 . SelectedRowIDArray )
{
Model . WBS_CostControl costControl = BLL . CostControlService . GetCostControlByCostControlId ( item ) ;
}
2021-08-13 11:15:59 +08:00
foreach ( JObject mergedRow in mergedData )
{
JObject values = mergedRow . Value < JObject > ( "values" ) ;
string costControlId = values . Value < string > ( "CostControlId" ) ;
2021-12-21 16:10:02 +08:00
//string totalNum = values.Value<string>("TotalNum");
//string realPrice = values.Value<string>("RealPrice");
//string planPrice = values.Value<string>("PlanPrice");
2021-08-13 11:15:59 +08:00
Model . WBS_CostControl costControl = BLL . CostControlService . GetCostControlByCostControlId ( costControlId ) ;
2021-12-21 16:10:02 +08:00
if ( this . Grid1 . SelectedRowIDArray . Contains ( costControlId ) )
2021-04-30 10:28:37 +08:00
{
2021-12-21 16:10:02 +08:00
costControl . IsSelected = true ;
}
else
{
costControl . IsSelected = false ;
2021-04-30 10:28:37 +08:00
}
2021-12-21 16:10:02 +08:00
BLL . CostControlService . UpdateCostControl ( costControl ) ;
2021-04-30 10:28:37 +08:00
}
}
2021-08-13 11:15:59 +08:00
BindGrid ( ) ;
}
Alert . ShowInTop ( "保存成功!" , MessageBoxIcon . Success ) ;
2021-04-30 10:28:37 +08:00
}
#endregion
#region 绑 定 数 据
private string upStartDate = string . Empty ;
private string upEndDate = string . Empty ;
protected void Grid1_RowDataBound ( object sender , GridRowEventArgs e )
{
string id = e . RowID ;
}
/// <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 ( ) ;
2021-08-13 11:15:59 +08:00
}
2021-04-30 10:28:37 +08:00
2021-08-13 11:15:59 +08:00
/// <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 . WbsSetMatchCostControlService . GetWbsSetMatchCostControls ( this . trWBS . SelectedNodeID ) ;
Model . Wbs_WbsSet wbeSet = BLL . WbsSetService . GetWbsSetByWbsSetId ( this . trWBS . SelectedNodeID ) ;
if ( codeList . Count > 0 ) //存在费控对应关系项
{
string codes = string . Empty ;
foreach ( var item in codeList )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
codes + = item . CostControlCode + "," ;
2021-04-30 10:28:37 +08:00
}
2023-05-26 10:24:02 +08:00
string strSql = "SELECT c.*,e.EquipmentMaterialTypeName FROM WBS_CostControl c left join WBS_EquipmentMaterialType e on c.EquipmentMaterialTypeId=e.EquipmentMaterialTypeId where @CostControlCodes like '%'+CostControlCode+'%' and WbsSetId=@WbsSetId" ;
2021-08-13 11:15:59 +08:00
List < SqlParameter > listStr = new List < SqlParameter > ( ) ;
listStr . Add ( new SqlParameter ( "@CostControlCodes" , codes ) ) ;
listStr . Add ( new SqlParameter ( "@WbsSetId" , this . trWBS . SelectedNodeID ) ) ;
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 ( ) ;
2021-12-21 16:10:02 +08:00
var costControls = BLL . CostControlService . GetSelectedCostControlsByWbsSetId ( this . trWBS . SelectedNodeID ) ;
if ( costControls . Count > 0 )
{
var selectIds = costControls . Select ( x = > x . CostControlId ) . ToArray ( ) ;
this . Grid1 . SelectedRowIDArray = selectIds ;
}
2021-04-30 10:28:37 +08:00
}
2021-09-15 14:50:52 +08:00
else
{
Grid1 . DataSource = null ;
Grid1 . DataBind ( ) ;
}
2021-04-30 10:28:37 +08:00
}
#endregion
#region 根 据 所 给 Id定位到对应具体的专业 、 单 位 工 程 、 子 单 位 工 程 、 分 部 、 子 分 部 、 分 项 、 子 分 项
private void getWBSSet ( )
{
string ProjectId = string . Empty ;
2022-04-20 17:24:24 +08:00
string pppInstallationId = string . Empty ;
2021-04-30 10:28:37 +08:00
string ppInstallationId = string . Empty ;
string pInstallationId = string . Empty ;
string InstallationId = string . Empty ;
string CnProfessionId = string . Empty ;
string UnitProjectId = string . Empty ;
string wbsSetParentId1 = string . Empty ;
string wbsSetParentId2 = string . Empty ;
string wbsSetParentId3 = string . Empty ;
Model . WBS_CnProfession cnPro = BLL . CnProfessionService . GetCnProfessionByCnProfessionId ( this . hdSelectId . Text ) ;
Model . Wbs_UnitProject UnitProject = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( this . hdSelectId . Text ) ;
Model . Wbs_WbsSet wbsSetParm = BLL . WbsSetService . GetWbsSetByWbsSetId ( this . hdSelectId . Text ) ;
Model . Project_Installation installationZT = BLL . Project_InstallationService . GetInstallationByInstallationId ( this . hdSelectId . Text ) ;
if ( cnPro ! = null )
{
ProjectId = cnPro . ProjectId ;
InstallationId = cnPro . InstallationId ;
pInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
where y . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
ppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
where z . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2022-04-20 17:24:24 +08:00
pppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
join a in Funs . DB . Project_Installation
on z . InstallationId equals a . SuperInstallationId
where a . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2021-04-30 10:28:37 +08:00
}
else if ( UnitProject ! = null )
{
if ( string . IsNullOrEmpty ( UnitProject . SuperUnitProjectId ) )
{
UnitProjectId = UnitProject . UnitProjectId ;
}
Model . WBS_CnProfession cn = BLL . CnProfessionService . GetCnProfessionByCnProfessionId ( UnitProject . CnProfessionId ) ;
if ( cn ! = null )
{
ProjectId = cn . ProjectId ;
InstallationId = cn . InstallationId ;
CnProfessionId = cn . CnProfessionId ;
pInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
where y . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
ppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
where z . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2022-04-20 17:24:24 +08:00
pppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
join a in Funs . DB . Project_Installation
on z . InstallationId equals a . SuperInstallationId
where a . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2021-04-30 10:28:37 +08:00
}
else //总图
{
Model . Project_Installation installation = BLL . Project_InstallationService . GetInstallationByInstallationId ( UnitProject . InstallationId ) ;
if ( installation ! = null )
{
ProjectId = installation . ProjectId ;
ppInstallationId = installation . InstallationId ;
}
}
}
else if ( wbsSetParm ! = null )
{
Model . WBS_CnProfession cn = BLL . CnProfessionService . GetCnProfessionByCnProfessionId ( wbsSetParm . CnProfessionId ) ;
if ( cn ! = null )
{
ProjectId = cn . ProjectId ;
InstallationId = cn . InstallationId ;
pInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
where y . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
ppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
where z . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2022-04-20 17:24:24 +08:00
pppInstallationId = ( from x in Funs . DB . Project_Installation
join y in Funs . DB . Project_Installation
on x . InstallationId equals y . SuperInstallationId
join z in Funs . DB . Project_Installation
on y . InstallationId equals z . SuperInstallationId
join a in Funs . DB . Project_Installation
on z . InstallationId equals a . SuperInstallationId
where a . InstallationId = = InstallationId
select x . InstallationId ) . FirstOrDefault ( ) ;
2021-04-30 10:28:37 +08:00
}
else
{
Model . Project_Installation installation = BLL . Project_InstallationService . GetInstallationByInstallationId ( wbsSetParm . InstallationId ) ;
if ( installation ! = null )
{
ProjectId = installation . ProjectId ;
ppInstallationId = installation . InstallationId ;
}
}
CnProfessionId = wbsSetParm . CnProfessionId ;
Model . Wbs_UnitProject unitpro = BLL . UnitProjectService . GetUnitProjectByUnitProjectId ( wbsSetParm . UnitProjectId ) ;
if ( string . IsNullOrEmpty ( unitpro . SuperUnitProjectId ) )
{
UnitProjectId = unitpro . UnitProjectId ;
}
if ( ! string . IsNullOrEmpty ( wbsSetParm . SuperWbsSetId ) )
{
wbsSetParentId1 = wbsSetParm . SuperWbsSetId ;
Model . Wbs_WbsSet wbsSetParent1 = BLL . WbsSetService . GetWbsSetByWbsSetId ( wbsSetParentId1 ) ;
if ( wbsSetParent1 ! = null )
{
if ( ! string . IsNullOrEmpty ( wbsSetParent1 . SuperWbsSetId ) )
{
wbsSetParentId2 = wbsSetParent1 . SuperWbsSetId ;
Model . Wbs_WbsSet wbsSetParent2 = BLL . WbsSetService . GetWbsSetByWbsSetId ( wbsSetParentId2 ) ;
if ( wbsSetParent2 ! = null )
{
if ( ! string . IsNullOrEmpty ( wbsSetParent2 . SuperWbsSetId ) )
{
wbsSetParentId3 = wbsSetParent2 . SuperWbsSetId ;
}
}
}
}
}
}
else if ( installationZT ! = null )
{
ProjectId = installationZT . ProjectId ;
ppInstallationId = installationZT . InstallationId ;
}
this . trWBS . Nodes . Clear ( ) ;
this . trWBS . ShowBorder = false ;
this . trWBS . ShowHeader = false ;
this . trWBS . EnableIcons = true ;
this . trWBS . AutoScroll = true ;
this . trWBS . EnableSingleClickExpand = true ;
2021-08-13 11:15:59 +08:00
var project = BLL . ProjectService . GetProjectByProjectId ( this . CurrUser . LoginProjectId ) ;
if ( project ! = null )
2021-04-30 10:28:37 +08:00
{
TreeNode rootNode = new TreeNode ( ) ;
rootNode . Text = project . ProjectName ;
rootNode . NodeID = project . ProjectId ;
rootNode . CommandName = "project" ;
rootNode . EnableExpandEvent = true ;
2022-04-20 17:24:24 +08:00
rootNode . EnableCheckBox = false ;
2021-04-30 10:28:37 +08:00
this . trWBS . Nodes . Add ( rootNode ) ;
if ( project . ProjectId = = ProjectId )
{
rootNode . Expanded = true ;
2022-04-20 17:24:24 +08:00
var installation0s = from x in Funs . DB . Project_Installation
where x . ProjectId = = ProjectId & & x . SuperInstallationId = = "0"
orderby x . InstallationCode
select x ;
foreach ( var installation0 in installation0s )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newInstallationNode0 = new TreeNode ( ) ;
newInstallationNode0 . Text = installation0 . InstallationName ;
newInstallationNode0 . NodeID = installation0 . InstallationId ;
newInstallationNode0 . CommandName = "installation" ;
newInstallationNode0 . EnableExpandEvent = true ;
newInstallationNode0 . EnableCheckBox = false ;
rootNode . Nodes . Add ( newInstallationNode0 ) ;
if ( installation0 . InstallationId = = pppInstallationId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var installations = from x in Funs . DB . Project_Installation
where x . ProjectId = = ProjectId & & x . SuperInstallationId = = installation0 . InstallationId
orderby x . InstallationCode
select x ;
foreach ( var installation in installations )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newInstallationNode = new TreeNode ( ) ;
newInstallationNode . Text = installation . InstallationName ;
newInstallationNode . NodeID = installation . InstallationId ;
newInstallationNode . CommandName = "installation" ;
newInstallationNode . EnableExpandEvent = true ;
newInstallationNode . EnableCheckBox = false ;
newInstallationNode0 . Nodes . Add ( newInstallationNode ) ;
if ( installation . InstallationId = = ppInstallationId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var installation2s = from x in Funs . DB . Project_Installation
where x . ProjectId = = ProjectId & & x . SuperInstallationId = = installation . InstallationId
orderby x . InstallationCode
select x ;
if ( installation2s . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newInstallationNode . Expanded = true ;
foreach ( var installation2 in installation2s )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newInstallationNode2 = new TreeNode ( ) ;
newInstallationNode2 . Text = installation2 . InstallationName ;
newInstallationNode2 . NodeID = installation2 . InstallationId ;
newInstallationNode2 . CommandName = "installation" ;
newInstallationNode2 . EnableExpandEvent = true ;
newInstallationNode2 . EnableCheckBox = false ;
newInstallationNode . Nodes . Add ( newInstallationNode2 ) ;
if ( installation2 . InstallationId = = pInstallationId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newInstallationNode2 . Expanded = true ;
var installation3s = from x in Funs . DB . Project_Installation
where x . ProjectId = = ProjectId & & x . SuperInstallationId = = installation2 . InstallationId
orderby x . InstallationCode
select x ;
foreach ( var installation3 in installation3s )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newInstallationNode3 = new TreeNode ( ) ;
newInstallationNode3 . Text = installation3 . InstallationName ;
newInstallationNode3 . NodeID = installation3 . InstallationId ;
newInstallationNode3 . CommandName = "installation" ;
newInstallationNode3 . EnableExpandEvent = true ;
newInstallationNode3 . EnableCheckBox = false ;
newInstallationNode2 . Nodes . Add ( newInstallationNode3 ) ;
if ( installation3 . InstallationId = = InstallationId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newInstallationNode3 . Expanded = true ;
#region 加 载 专 业 、 分 部 分 项 内 容
var cnProfessions = from x in Funs . DB . WBS_CnProfession where x . InstallationId = = InstallationId orderby x . OldId select x ;
foreach ( var cnProfession in cnProfessions )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newCnProfessionNode = new TreeNode ( ) ;
newCnProfessionNode . Text = cnProfession . CnProfessionName ;
newCnProfessionNode . NodeID = cnProfession . CnProfessionId ;
newCnProfessionNode . CommandName = "cnProfession" ;
newCnProfessionNode . CommandArgument = cnProfession . Weights = = null ? null : cnProfession . Weights . ToString ( ) ;
newCnProfessionNode . ToolTip = cnProfession . CnProfessionCode ;
newCnProfessionNode . EnableExpandEvent = true ;
newCnProfessionNode . EnableClickEvent = true ;
newInstallationNode3 . Nodes . Add ( newCnProfessionNode ) ;
if ( ! string . IsNullOrEmpty ( UnitProjectId ) )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
//加载专业下的单位工程
if ( cnProfession . CnProfessionId = = CnProfessionId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newCnProfessionNode . Expanded = true ;
var UnitProjects = from x in Funs . DB . Wbs_UnitProject where x . CnProfessionId = = CnProfessionId & & x . SuperUnitProjectId = = null orderby x . SortIndex select x ;
foreach ( var unitProject in UnitProjects )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newNodeUnitPorject = new TreeNode ( ) ;
newNodeUnitPorject . Text = unitProject . UnitProjectName ;
newNodeUnitPorject . NodeID = unitProject . UnitProjectId ;
newNodeUnitPorject . CommandName = "unitProject" ;
newNodeUnitPorject . EnableExpandEvent = true ;
newNodeUnitPorject . EnableCheckBox = true ;
newNodeUnitPorject . EnableCheckEvent = true ;
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNodeUnitPorject . Checked = true ;
}
else
{
newNodeUnitPorject . Checked = false ;
}
newNodeUnitPorject . EnableClickEvent = true ;
newCnProfessionNode . Expanded = true ;
newCnProfessionNode . Nodes . Add ( newNodeUnitPorject ) ;
if ( unitProject . UnitProjectId ! = UnitProjectId )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNodeUnitPorject . Nodes . Add ( emptyNode ) ;
}
else
{
2022-04-20 17:24:24 +08:00
#region 不 存 在 子 单 位 工 程
if ( wbsSetParm ! = null )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
if ( wbsSetParm . UnitProjectId ! = UnitProjectId )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNodeUnitPorject . Nodes . Add ( emptyNode ) ;
}
else
{
newNodeUnitPorject . Expanded = true ;
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = UnitProjectId & & x . SuperWbsSetId = = null orderby x . WbsSetCode select x ;
if ( wbsSet1s . Count ( ) > 0 )
2021-08-13 11:15:59 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet1 in wbsSet1s )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newwbsSet1Node = new TreeNode ( ) ;
newwbsSet1Node . Text = wbsSet1 . WbsSetName ;
newwbsSet1Node . NodeID = wbsSet1 . WbsSetId ;
newwbsSet1Node . CommandName = "wbsSet" ;
newwbsSet1Node . CommandArgument = wbsSet1 . Weights = = null ? null : wbsSet1 . Weights . ToString ( ) ;
newwbsSet1Node . ToolTip = wbsSet1 . WbsSetCode ;
newwbsSet1Node . EnableExpandEvent = true ;
newwbsSet1Node . EnableCheckBox = true ;
newwbsSet1Node . EnableCheckEvent = true ;
if ( wbsSet1 . IsSelected = = true & & wbsSet1 . IsApprove = = null )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
wbsSet1 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
}
if ( wbsSet1 . IsApprove = = true )
{
newwbsSet1Node . Checked = true ;
}
else
{
newwbsSet1Node . Checked = false ;
}
newwbsSet1Node . EnableClickEvent = true ;
newNodeUnitPorject . Nodes . Add ( newwbsSet1Node ) ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet1 . WbsSetId ) ;
if ( wbsSets . Count > 0 )
{
var childWbsSets2 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet1Node . NodeID ) ;
if ( childWbsSets2 . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet1 . WbsSetId , wbsSetParm . WbsSetId ) )
2021-08-13 11:15:59 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet2 in childWbsSets2 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
if ( wbsSet1 . WbsSetId = = wbsSet2 . SuperWbsSetId )
{
newwbsSet1Node . Expanded = true ;
}
TreeNode newwbsSet2Node = new TreeNode ( ) ;
newwbsSet2Node . Text = wbsSet2 . WbsSetName ;
newwbsSet2Node . NodeID = wbsSet2 . WbsSetId ;
newwbsSet2Node . CommandName = "wbsSet" ;
newwbsSet2Node . CommandArgument = wbsSet2 . Weights = = null ? null : wbsSet2 . Weights . ToString ( ) ;
newwbsSet2Node . ToolTip = wbsSet2 . WbsSetCode ;
newwbsSet2Node . EnableExpandEvent = true ;
newwbsSet2Node . EnableCheckBox = true ;
newwbsSet2Node . EnableCheckEvent = true ;
if ( wbsSet2 . IsSelected = = true & & wbsSet2 . IsApprove = = null )
{
wbsSet2 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet2 ) ;
}
if ( wbsSet2 . IsApprove = = true )
{
newwbsSet2Node . Checked = true ;
}
else
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newwbsSet2Node . Checked = false ;
}
newwbsSet2Node . EnableClickEvent = true ;
newwbsSet1Node . Nodes . Add ( newwbsSet2Node ) ;
var ws2 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet2 . WbsSetId ) ;
if ( ws2 . Count > 0 )
{
var childWbsSets3 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet2Node . NodeID ) ;
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet2 . WbsSetId , wbsSetParm . WbsSetId ) )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newwbsSet2Node . Expanded = true ;
if ( childWbsSets3 . Count ( ) > 0 )
2021-08-13 11:15:59 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet3 in childWbsSets3 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newwbsSet3Node = new TreeNode ( ) ;
newwbsSet3Node . Text = wbsSet3 . WbsSetName ;
newwbsSet3Node . NodeID = wbsSet3 . WbsSetId ;
newwbsSet3Node . CommandName = "wbsSet" ;
newwbsSet3Node . CommandArgument = wbsSet3 . Weights = = null ? null : wbsSet3 . Weights . ToString ( ) ;
newwbsSet3Node . ToolTip = wbsSet3 . WbsSetCode ;
newwbsSet3Node . EnableExpandEvent = true ;
newwbsSet3Node . EnableCheckBox = true ;
newwbsSet3Node . EnableCheckEvent = true ;
if ( wbsSet3 . IsSelected = = true & & wbsSet3 . IsApprove = = null )
{
wbsSet3 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet3 ) ;
}
if ( wbsSet3 . IsApprove = = true )
{
newwbsSet3Node . Checked = true ;
}
else
{
newwbsSet3Node . Checked = false ;
}
newwbsSet3Node . EnableClickEvent = true ;
newwbsSet2Node . Nodes . Add ( newwbsSet3Node ) ;
var ws3 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet3 . WbsSetId ) ;
if ( ws3 . Count > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var childWbsSets4 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet3Node . NodeID ) ;
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet3 . WbsSetId , wbsSetParm . WbsSetId ) )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newwbsSet3Node . Expanded = true ;
if ( childWbsSets4 . Count ( ) > 0 )
2021-08-13 11:15:59 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet4 in childWbsSets4 )
{
TreeNode newwbsSet4Node = new TreeNode ( ) ;
newwbsSet4Node . Text = wbsSet4 . WbsSetName ;
newwbsSet4Node . NodeID = wbsSet4 . WbsSetId ;
newwbsSet4Node . CommandName = "wbsSet" ;
newwbsSet4Node . CommandArgument = wbsSet4 . Weights = = null ? null : wbsSet4 . Weights . ToString ( ) ;
newwbsSet4Node . ToolTip = wbsSet4 . WbsSetCode ;
newwbsSet4Node . EnableExpandEvent = true ;
newwbsSet4Node . EnableCheckBox = true ;
newwbsSet4Node . EnableCheckEvent = true ;
if ( wbsSet4 . IsSelected = = true & & wbsSet4 . IsApprove = = null )
{
wbsSet4 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet4 ) ;
}
if ( wbsSet4 . IsApprove = = true )
{
newwbsSet4Node . Checked = true ;
}
else
{
newwbsSet4Node . Checked = false ;
}
newwbsSet4Node . EnableClickEvent = true ;
newwbsSet3Node . Nodes . Add ( newwbsSet4Node ) ;
}
2021-08-13 11:15:59 +08:00
}
2022-04-20 17:24:24 +08:00
}
else
{
if ( childWbsSets4 . Count ( ) > 0 )
2021-08-13 11:15:59 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet3Node . Nodes . Add ( emptyNode ) ;
2021-08-13 11:15:59 +08:00
}
2021-04-30 10:28:37 +08:00
}
}
2021-08-13 11:15:59 +08:00
}
2022-04-20 17:24:24 +08:00
}
}
else
{
if ( childWbsSets3 . Count ( ) > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet2Node . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
2021-08-13 11:15:59 +08:00
}
2022-04-20 17:24:24 +08:00
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet1Node . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
2021-08-13 11:15:59 +08:00
}
2022-04-20 17:24:24 +08:00
2021-04-30 10:28:37 +08:00
}
}
2022-04-20 17:24:24 +08:00
else //单位工程下直接是分项内容,如质量行为
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var wbsSet3s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = UnitProjectId & & x . SuperWbsSetId = = null orderby x . WbsSetCode select x ;
if ( wbsSet3s . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet3 in wbsSet3s )
{
TreeNode newwbsSet3Node = new TreeNode ( ) ;
newwbsSet3Node . Text = wbsSet3 . WbsSetName ;
newwbsSet3Node . NodeID = wbsSet3 . WbsSetId ;
newwbsSet3Node . CommandName = "wbsSet" ;
newwbsSet3Node . CommandArgument = wbsSet3 . Weights = = null ? null : wbsSet3 . Weights . ToString ( ) ;
newwbsSet3Node . ToolTip = wbsSet3 . WbsSetCode ;
newwbsSet3Node . EnableExpandEvent = true ;
newwbsSet3Node . EnableCheckBox = true ;
newwbsSet3Node . EnableCheckEvent = true ;
if ( wbsSet3 . IsSelected = = true & & wbsSet3 . IsApprove = = null )
{
wbsSet3 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet3 ) ;
}
if ( wbsSet3 . IsApprove = = true )
{
newwbsSet3Node . Checked = true ;
}
else
{
newwbsSet3Node . Checked = false ;
}
newwbsSet3Node . EnableClickEvent = true ;
newNodeUnitPorject . Nodes . Add ( newwbsSet3Node ) ;
}
2021-04-30 10:28:37 +08:00
}
}
}
}
2022-04-20 17:24:24 +08:00
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNodeUnitPorject . Nodes . Add ( emptyNode ) ;
}
#endregion
2021-04-30 10:28:37 +08:00
}
}
2022-04-20 17:24:24 +08:00
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newCnProfessionNode . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
2022-04-20 17:24:24 +08:00
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newCnProfessionNode . Nodes . Add ( emptyNode ) ;
}
2021-04-30 10:28:37 +08:00
}
2022-04-20 17:24:24 +08:00
#endregion
2021-04-30 10:28:37 +08:00
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
2022-04-20 17:24:24 +08:00
newInstallationNode3 . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
2022-04-20 17:24:24 +08:00
newInstallationNode2 . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
2022-04-20 17:24:24 +08:00
else //总图
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var unitProjects = from x in Funs . DB . Wbs_UnitProject where x . InstallationId = = installation . InstallationId & & x . SuperUnitProjectId = = null orderby x . SortIndex , x . UnitProjectCode select x ;
foreach ( var unitProject in unitProjects )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newNodeUnitPorject = new TreeNode ( ) ;
newNodeUnitPorject . Text = unitProject . UnitProjectName ;
newNodeUnitPorject . NodeID = unitProject . UnitProjectId ;
newNodeUnitPorject . CommandName = "unitProject" ;
newNodeUnitPorject . EnableExpandEvent = true ;
newNodeUnitPorject . EnableCheckBox = true ;
newNodeUnitPorject . EnableCheckEvent = true ;
if ( unitProject . IsSelected = = true & & unitProject . IsApprove = = null )
{
unitProject . IsApprove = true ;
BLL . UnitProjectService . UpdateUnitProject ( unitProject ) ;
}
if ( unitProject . IsApprove = = true )
{
newNodeUnitPorject . Checked = true ;
}
else
{
newNodeUnitPorject . Checked = false ;
}
newNodeUnitPorject . EnableClickEvent = true ;
if ( ! string . IsNullOrEmpty ( UnitProjectId ) )
{
newInstallationNode . Expanded = true ;
}
newInstallationNode . Nodes . Add ( newNodeUnitPorject ) ;
if ( unitProject . UnitProjectId ! = UnitProjectId )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNodeUnitPorject . Nodes . Add ( emptyNode ) ;
}
else
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
if ( wbsSetParm ! = null )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newNodeUnitPorject . Expanded = true ;
var wbsSet1s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = UnitProjectId & & x . SuperWbsSetId = = null orderby x . WbsSetCode select x ;
if ( wbsSet1s . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet1 in wbsSet1s )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newwbsSet1Node = new TreeNode ( ) ;
newwbsSet1Node . Text = wbsSet1 . WbsSetName ;
newwbsSet1Node . NodeID = wbsSet1 . WbsSetId ;
newwbsSet1Node . CommandName = "wbsSet" ;
newwbsSet1Node . CommandArgument = wbsSet1 . Weights = = null ? null : wbsSet1 . Weights . ToString ( ) ;
newwbsSet1Node . ToolTip = wbsSet1 . WbsSetCode ;
newwbsSet1Node . EnableExpandEvent = true ;
newwbsSet1Node . EnableCheckBox = true ;
newwbsSet1Node . EnableCheckEvent = true ;
if ( wbsSet1 . IsSelected = = true & & wbsSet1 . IsApprove = = null )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
wbsSet1 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet1 ) ;
}
if ( wbsSet1 . IsApprove = = true )
{
newwbsSet1Node . Checked = true ;
}
else
{
newwbsSet1Node . Checked = false ;
}
newwbsSet1Node . EnableClickEvent = true ;
newNodeUnitPorject . Nodes . Add ( newwbsSet1Node ) ;
bool needAddTempNode = false ;
var wbsSets = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet1 . WbsSetId ) ;
foreach ( var wbsSet in wbsSets )
{
var childWbsSets = from x in Funs . DB . Wbs_WbsSet where x . SuperWbsSetId = = wbsSet . WbsSetId & & x . NoShow = = null select x ;
if ( childWbsSets . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
needAddTempNode = true ;
break ;
}
}
if ( needAddTempNode )
{
var childWbsSets2 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet1Node . NodeID ) ;
if ( childWbsSets2 . Count ( ) > 0 )
{
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet1 . WbsSetId , wbsSetParm . WbsSetId ) )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet2 in childWbsSets2 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
if ( wbsSet1 . WbsSetId = = wbsSet2 . SuperWbsSetId )
{
newwbsSet1Node . Expanded = true ;
}
TreeNode newwbsSet2Node = new TreeNode ( ) ;
newwbsSet2Node . Text = wbsSet2 . WbsSetName ;
newwbsSet2Node . NodeID = wbsSet2 . WbsSetId ;
newwbsSet2Node . CommandName = "wbsSet" ;
newwbsSet2Node . CommandArgument = wbsSet2 . Weights = = null ? null : wbsSet2 . Weights . ToString ( ) ;
newwbsSet2Node . ToolTip = wbsSet2 . WbsSetCode ;
newwbsSet2Node . EnableExpandEvent = true ;
newwbsSet2Node . EnableCheckBox = true ;
newwbsSet2Node . EnableCheckEvent = true ;
if ( wbsSet2 . IsSelected = = true & & wbsSet2 . IsApprove = = null )
{
wbsSet2 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet2 ) ;
}
if ( wbsSet2 . IsApprove = = true )
{
newwbsSet2Node . Checked = true ;
}
else
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newwbsSet2Node . Checked = false ;
}
newwbsSet2Node . EnableClickEvent = true ;
newwbsSet1Node . Nodes . Add ( newwbsSet2Node ) ;
bool needAddTempNode2 = false ;
var ws2 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet2 . WbsSetId ) ;
foreach ( var w2 in ws2 )
{
var childWbsSets = from x in Funs . DB . Wbs_WbsSet where x . SuperWbsSetId = = w2 . WbsSetId & & x . NoShow = = null select x ;
if ( childWbsSets . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
needAddTempNode2 = true ;
break ;
}
}
if ( needAddTempNode2 )
{
var childWbsSets3 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet2Node . NodeID ) ;
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet2 . WbsSetId , wbsSetParm . WbsSetId ) )
{
newwbsSet2Node . Expanded = true ;
if ( childWbsSets3 . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet3 in childWbsSets3 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode newwbsSet3Node = new TreeNode ( ) ;
newwbsSet3Node . Text = wbsSet3 . WbsSetName ;
newwbsSet3Node . NodeID = wbsSet3 . WbsSetId ;
newwbsSet3Node . CommandName = "wbsSet" ;
newwbsSet3Node . CommandArgument = wbsSet3 . Weights = = null ? null : wbsSet3 . Weights . ToString ( ) ;
newwbsSet3Node . ToolTip = wbsSet3 . WbsSetCode ;
newwbsSet3Node . EnableExpandEvent = true ;
newwbsSet3Node . EnableCheckBox = true ;
newwbsSet3Node . EnableCheckEvent = true ;
if ( wbsSet3 . IsSelected = = true & & wbsSet3 . IsApprove = = null )
{
wbsSet3 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet3 ) ;
}
if ( wbsSet3 . IsApprove = = true )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
newwbsSet3Node . Checked = true ;
}
else
{
newwbsSet3Node . Checked = false ;
}
newwbsSet3Node . EnableClickEvent = true ;
newwbsSet2Node . Nodes . Add ( newwbsSet3Node ) ;
bool needAddTempNode3 = false ;
var ws3 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( wbsSet3 . WbsSetId ) ;
foreach ( var w3 in ws3 )
{
var childWbsSets = from x in Funs . DB . Wbs_WbsSet where x . SuperWbsSetId = = w3 . WbsSetId & & x . NoShow = = null select x ;
if ( childWbsSets . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
needAddTempNode3 = true ;
break ;
}
}
if ( needAddTempNode3 )
{
var childWbsSets4 = BLL . WbsSetService . GetWbsSetsBySuperWbsSetId ( newwbsSet3Node . NodeID ) ;
if ( BLL . WbsSetService . IsExitWbsSetById2 ( wbsSet3 . WbsSetId , wbsSetParm . WbsSetId ) )
{
newwbsSet3Node . Expanded = true ;
if ( childWbsSets4 . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet4 in childWbsSets4 )
{
TreeNode newwbsSet4Node = new TreeNode ( ) ;
newwbsSet4Node . Text = wbsSet4 . WbsSetName ;
newwbsSet4Node . NodeID = wbsSet4 . WbsSetId ;
newwbsSet4Node . CommandName = "wbsSet" ;
newwbsSet4Node . CommandArgument = wbsSet4 . Weights = = null ? null : wbsSet4 . Weights . ToString ( ) ;
newwbsSet4Node . ToolTip = wbsSet4 . WbsSetCode ;
newwbsSet4Node . EnableExpandEvent = true ;
newwbsSet4Node . EnableCheckBox = true ;
newwbsSet4Node . EnableCheckEvent = true ;
if ( wbsSet4 . IsSelected = = true & & wbsSet4 . IsApprove = = null )
{
wbsSet4 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet4 ) ;
}
if ( wbsSet4 . IsApprove = = true )
{
newwbsSet4Node . Checked = true ;
}
else
{
newwbsSet4Node . Checked = false ;
}
newwbsSet4Node . EnableClickEvent = true ;
newwbsSet3Node . Nodes . Add ( newwbsSet4Node ) ;
}
2021-04-30 10:28:37 +08:00
}
2022-04-20 17:24:24 +08:00
}
else
{
if ( childWbsSets4 . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet3Node . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
}
2022-04-20 17:24:24 +08:00
}
}
else
{
if ( childWbsSets3 . Count ( ) > 0 )
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet2Node . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
}
2022-04-20 17:24:24 +08:00
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newwbsSet1Node . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
2022-04-20 17:24:24 +08:00
2021-04-30 10:28:37 +08:00
}
}
2022-04-20 17:24:24 +08:00
else //单位工程下直接是分项内容,如质量行为
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
var wbsSet3s = from x in Funs . DB . Wbs_WbsSet where x . UnitProjectId = = UnitProjectId & & x . SuperWbsSetId = = null orderby x . WbsSetCode select x ;
if ( wbsSet3s . Count ( ) > 0 )
2021-04-30 10:28:37 +08:00
{
2022-04-20 17:24:24 +08:00
foreach ( var wbsSet3 in wbsSet3s )
{
TreeNode newwbsSet3Node = new TreeNode ( ) ;
newwbsSet3Node . Text = wbsSet3 . WbsSetName ;
newwbsSet3Node . NodeID = wbsSet3 . WbsSetId ;
newwbsSet3Node . CommandName = "wbsSet" ;
newwbsSet3Node . CommandArgument = wbsSet3 . Weights = = null ? null : wbsSet3 . Weights . ToString ( ) ;
newwbsSet3Node . ToolTip = wbsSet3 . WbsSetCode ;
newwbsSet3Node . EnableExpandEvent = true ;
newwbsSet3Node . EnableCheckBox = true ;
newwbsSet3Node . EnableCheckEvent = true ;
if ( wbsSet3 . IsSelected = = true & & wbsSet3 . IsApprove = = null )
{
wbsSet3 . IsApprove = true ;
BLL . WbsSetService . UpdateWbsSet ( wbsSet3 ) ;
}
if ( wbsSet3 . IsApprove = = true )
{
newwbsSet3Node . Checked = true ;
}
else
{
newwbsSet3Node . Checked = false ;
}
newwbsSet3Node . EnableClickEvent = true ;
newNodeUnitPorject . Nodes . Add ( newwbsSet3Node ) ;
}
2021-04-30 10:28:37 +08:00
}
}
}
2022-04-20 17:24:24 +08:00
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newNodeUnitPorject . Nodes . Add ( emptyNode ) ;
}
2021-04-30 10:28:37 +08:00
}
}
}
}
2022-04-20 17:24:24 +08:00
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
newInstallationNode0 . Nodes . Add ( emptyNode ) ;
}
2021-04-30 10:28:37 +08:00
}
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
2022-04-20 17:24:24 +08:00
rootNode . Nodes . Add ( emptyNode ) ;
2021-04-30 10:28:37 +08:00
}
}
}
else
{
TreeNode emptyNode = new TreeNode ( ) ;
emptyNode . Text = "" ;
emptyNode . NodeID = "" ;
rootNode . Nodes . Add ( emptyNode ) ;
}
}
this . trWBS . SelectedNodeID = this . hdSelectId . Text ;
BindGrid ( ) ;
}
#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 . WBSSetAuditMenuId ) ;
if ( buttonList . Count ( ) > 0 )
{
if ( buttonList . Contains ( BLL . Const . BtnAdd ) )
{
this . btnMenuAdd . Hidden = false ;
2021-08-13 11:15:59 +08:00
this . btnAdd . Hidden = false ;
2021-04-30 10:28:37 +08:00
this . btnMenuCopy . Hidden = false ;
2021-12-21 16:10:02 +08:00
//this.btnMenuDetail.Hidden = false;
//this.btnMenuWeekDetail.Hidden = false;
2021-08-13 11:15:59 +08:00
//this.btnMenuCopy2.Hidden = false;
2021-04-30 10:28:37 +08:00
}
if ( buttonList . Contains ( BLL . Const . BtnModify ) )
{
this . btnMenuEdit . Hidden = false ;
2021-08-13 11:15:59 +08:00
this . btnMenuModify . Hidden = false ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
if ( buttonList . Contains ( BLL . Const . BtnSave ) )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
this . btnSave . Hidden = false ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
if ( buttonList . Contains ( BLL . Const . BtnDelete ) )
2021-04-30 10:28:37 +08:00
{
2021-08-13 11:15:59 +08:00
this . btnMenuDelete . Hidden = false ;
this . btnMenuDel . Hidden = false ;
2021-04-30 10:28:37 +08:00
}
2021-08-13 11:15:59 +08:00
//if (buttonList.Contains(BLL.Const.BtnAuditing))
//{
// this.btnMenuAudit.Hidden = false;
//}
2021-04-30 10:28:37 +08:00
}
}
#endregion
}
}