2424 lines
144 KiB
C#
2424 lines
144 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 树加载
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.trWBS.Nodes.Clear();
|
|
this.trWBS.ShowBorder = false;
|
|
this.trWBS.ShowHeader = false;
|
|
this.trWBS.EnableIcons = true;
|
|
this.trWBS.AutoScroll = true;
|
|
this.trWBS.EnableSingleClickExpand = true;
|
|
//var 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);
|
|
if (installation != null)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
#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();
|
|
newNode.Text = "[" + installation.InstallationCode + "]" + installation.InstallationName;
|
|
newNode.NodeID = installation.InstallationId;
|
|
newNode.CommandName = "installation";
|
|
newNode.EnableExpandEvent = true;
|
|
newNode.EnableClickEvent = true;
|
|
newNode.EnableCheckBox = false;
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
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();
|
|
newNode.Text = "[" + installation.InstallationCode + "]" + installation.InstallationName;
|
|
newNode.NodeID = installation.InstallationId;
|
|
newNode.CommandName = "installation";
|
|
newNode.EnableExpandEvent = true;
|
|
newNode.EnableClickEvent = true;
|
|
newNode.EnableCheckBox = false;
|
|
e.Node.Nodes.Add(newNode);
|
|
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
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;
|
|
newNode.EnableCheckBox = false;
|
|
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;
|
|
newNode.EnableCheckBox = false;
|
|
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;
|
|
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;
|
|
e.Node.Nodes.Add(newNode);
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
else if (e.Node.CommandName == "unitProject") //展开单位工程节点
|
|
{
|
|
var wbsSet1s = from x in Funs.DB.Wbs_WbsSet where x.UnitProjectId == e.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;
|
|
e.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);
|
|
}
|
|
//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);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
if (wbsSets.Count > 0)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNode.Nodes.Add(emptyNode);
|
|
}
|
|
//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);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 树节点复选框勾选事件
|
|
|
|
/// <summary>
|
|
/// 树节点复选框勾选事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void trWBS_NodeCheck(object sender, FineUIPro.TreeCheckEventArgs e)
|
|
{
|
|
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);
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
bool b = true; //是否对父级节点执行选中状态的更新操作
|
|
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(e.NodeID);
|
|
if (wbsSet != null)
|
|
{
|
|
wbsSet.IsSelected = e.Checked;
|
|
wbsSet.IsApprove = e.Checked;
|
|
BLL.WbsSetService.UpdateWbsSet(wbsSet);
|
|
if (e.Checked == false) //当节点取消选中时,判断是否需要对父级节点执行选中状态的更新操作
|
|
{
|
|
if (BLL.WbsSetService.IsExitOtherApproveWbsSetsBySuperWbsSetId(wbsSet.SuperWbsSetId, wbsSet.WbsSetId))
|
|
{
|
|
b = false;
|
|
}
|
|
}
|
|
if (b)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
TreeNode unitProjectNode = null;
|
|
if (e.Node.ParentNode.CommandName == "unitProject")
|
|
{
|
|
unitProjectNode = e.Node.ParentNode;
|
|
}
|
|
else if (e.Node.ParentNode.ParentNode.CommandName == "unitProject")
|
|
{
|
|
unitProjectNode = e.Node.ParentNode.ParentNode;
|
|
}
|
|
else if (e.Node.ParentNode.ParentNode.ParentNode.CommandName == "unitProject")
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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)
|
|
{
|
|
cnProfession.IsSelected = e.Checked;
|
|
cnProfession.IsApprove = e.Checked;
|
|
BLL.CnProfessionService.UpdateCnProfession(cnProfession);
|
|
}
|
|
}
|
|
//if (e.Checked)
|
|
//{
|
|
// CheckAllParentNodes(e.Node);
|
|
// CheckAllChildNodes(e.Node);
|
|
// this.UpdateSelect(e.Node, true);
|
|
//}
|
|
//else
|
|
//{
|
|
// 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);
|
|
// }
|
|
//}
|
|
BindGrid();
|
|
}
|
|
|
|
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)
|
|
{
|
|
if (node.CommandName == "unitProject")
|
|
{
|
|
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
|
|
|
|
#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)
|
|
{
|
|
ShowNotify("修改成功!", MessageBoxIcon.Success);
|
|
|
|
getWBSSet();
|
|
}
|
|
#endregion
|
|
|
|
#region 关闭窗口
|
|
/// <summary>
|
|
/// 关闭窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
ShowNotify("拷贝成功!", MessageBoxIcon.Success);
|
|
|
|
getWBSSet();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window3_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 右键增加、修改、拷贝、删除方法
|
|
/// <summary>
|
|
/// 增加费控项
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(trWBS.SelectedNodeID))
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键增加事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.trWBS.SelectedNode != null)
|
|
{
|
|
//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") //非项目、装置节点可以增加
|
|
{
|
|
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
|
|
{
|
|
if (this.trWBS.SelectedNode.Text == "总图")
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键修改事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.trWBS.SelectedNode != null)
|
|
{
|
|
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.WBSSetAuditMenuId, BLL.Const.BtnModify))
|
|
//{
|
|
if (this.trWBS.SelectedNode.CommandName != "project" && this.trWBS.SelectedNode.CommandName != "installation") //非项目、装置节点可以修改
|
|
{
|
|
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, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
if (this.trWBS.SelectedNode.Text == "总图")
|
|
{
|
|
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, "编辑 - ")));
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("项目、装置节点无法修改!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
//}
|
|
//else
|
|
//{
|
|
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuModify_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("CostControlEdit.aspx?type=modify&Id={0}&Code={1}", this.Grid1.SelectedRowID, this.trWBS.SelectedNodeID, "修改 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置计划按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDetail_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("CostControlDetailEdit.aspx?Id={0}", this.Grid1.SelectedRowID, "修改 - ")));
|
|
}
|
|
|
|
/// <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, "修改 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 拷贝
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.trWBS.SelectedNode != null)
|
|
{
|
|
if (this.trWBS.SelectedNode.CommandName != "project" && this.trWBS.SelectedNode.CommandName != "installation" && this.trWBS.SelectedNode.CommandName != "cnProfession" && this.trWBS.SelectedNode.CommandName != "unitProject") //非项目、装置、专业、单位工程节点可以拷贝
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分级
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuCopy2_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.BtnAdd))
|
|
//{
|
|
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")
|
|
{
|
|
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));
|
|
}
|
|
else if (this.trWBS.SelectedNode.CommandName == "wbsSet")
|
|
{
|
|
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));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("项目、装置、专业和单位工程节点无法分级!", MessageBoxIcon.Warning);
|
|
}
|
|
//}
|
|
//else
|
|
//{
|
|
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键删除事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.trWBS.SelectedNode != null)
|
|
{
|
|
//if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectWBSSetAuditMenuId, BLL.Const.BtnAuditing))
|
|
//{
|
|
if (this.trWBS.SelectedNode.CommandName != "project" && this.trWBS.SelectedNode.CommandName != "installation" && this.trWBS.SelectedNode.CommandName != "cnProfession") //非项目、装置、专业节点可以修改
|
|
{
|
|
DeleteData();
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("项目、装置和专业节点无法删除!", MessageBoxIcon.Warning);
|
|
}
|
|
//}
|
|
//else
|
|
//{
|
|
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
//}
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
foreach (var id in this.Grid1.SelectedRowIDArray)
|
|
{
|
|
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(id);
|
|
BLL.WbsSetMatchCostControlService.DeleteWbsSetMatchCostControlByWbsSetIdAndCostControlCode(this.trWBS.SelectedNodeID, costControl.CostControlCode);
|
|
BLL.CostControlService.DeleteCostControl(id);
|
|
Grid1.DataBind();
|
|
BindGrid();
|
|
}
|
|
BLL.LogService.AddSys_Log(this.CurrUser, Grid1.SelectedRowID, Grid1.SelectedRowID, BLL.Const.ProjectControlPointMenuId, "删除费用对应关系");
|
|
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
|
|
/// <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;
|
|
BLL.WbsSetService.DeleteWbsSetByUnitProjectId(id);
|
|
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)
|
|
{
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(childWbsSet3.WbsSetId); //删除费控项
|
|
BLL.WbsSetService.DeleteWbsSet(childWbsSet3.WbsSetId);
|
|
}
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(childWbsSet2.WbsSetId); //删除费控项
|
|
BLL.WbsSetService.DeleteWbsSet(childWbsSet2.WbsSetId);
|
|
}
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(childWbsSet1.WbsSetId); //删除费控项
|
|
BLL.WbsSetService.DeleteWbsSet(childWbsSet1.WbsSetId);
|
|
}
|
|
BLL.CostControlService.DeleteCostControlByWbsSetId(id); //删除费控项
|
|
BLL.WbsSetService.DeleteWbsSet(id);
|
|
}
|
|
}
|
|
}
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
getWBSSet();
|
|
}
|
|
|
|
/// <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))
|
|
////{
|
|
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);
|
|
}
|
|
//}
|
|
//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)
|
|
{
|
|
if (Grid1.Rows.Count > 0)
|
|
{
|
|
JArray mergedData = Grid1.GetMergedData();
|
|
|
|
bool isPass = true;
|
|
if (isPass)
|
|
{
|
|
foreach (var item in this.Grid1.SelectedRowIDArray)
|
|
{
|
|
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(item);
|
|
|
|
}
|
|
|
|
foreach (JObject mergedRow in mergedData)
|
|
{
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
string costControlId = values.Value<string>("CostControlId");
|
|
//string totalNum = values.Value<string>("TotalNum");
|
|
//string realPrice = values.Value<string>("RealPrice");
|
|
//string planPrice = values.Value<string>("PlanPrice");
|
|
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
|
|
if (this.Grid1.SelectedRowIDArray.Contains(costControlId))
|
|
{
|
|
costControl.IsSelected = true;
|
|
}
|
|
else
|
|
{
|
|
costControl.IsSelected = false;
|
|
}
|
|
BLL.CostControlService.UpdateCostControl(costControl);
|
|
}
|
|
}
|
|
BindGrid();
|
|
}
|
|
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
|
|
}
|
|
#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();
|
|
}
|
|
|
|
/// <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)
|
|
{
|
|
codes += item.CostControlCode + ",";
|
|
}
|
|
string strSql = "SELECT * FROM WBS_CostControl where @CostControlCodes like '%'+CostControlCode+'%' and WbsSetId=@WbsSetId";
|
|
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();
|
|
var costControls = BLL.CostControlService.GetSelectedCostControlsByWbsSetId(this.trWBS.SelectedNodeID);
|
|
if (costControls.Count > 0)
|
|
{
|
|
var selectIds = costControls.Select(x => x.CostControlId).ToArray();
|
|
this.Grid1.SelectedRowIDArray = selectIds;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Grid1.DataSource = null;
|
|
Grid1.DataBind();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 根据所给Id定位到对应具体的专业、单位工程、子单位工程、分部、子分部、分项、子分项
|
|
private void getWBSSet()
|
|
{
|
|
string ProjectId = string.Empty;
|
|
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();
|
|
}
|
|
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();
|
|
}
|
|
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();
|
|
}
|
|
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;
|
|
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;
|
|
this.trWBS.Nodes.Add(rootNode);
|
|
if (project.ProjectId == ProjectId)
|
|
{
|
|
rootNode.Expanded = true;
|
|
var installations = from x in Funs.DB.Project_Installation
|
|
where x.ProjectId == ProjectId && x.SuperInstallationId == "0"
|
|
orderby x.InstallationCode
|
|
select x;
|
|
foreach (var installation in installations)
|
|
{
|
|
TreeNode newInstallationNode = new TreeNode();
|
|
newInstallationNode.Text = installation.InstallationName;
|
|
newInstallationNode.NodeID = installation.InstallationId;
|
|
newInstallationNode.CommandName = "installation";
|
|
newInstallationNode.EnableExpandEvent = true;
|
|
rootNode.Nodes.Add(newInstallationNode);
|
|
if (installation.InstallationId == ppInstallationId)
|
|
{
|
|
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)
|
|
{
|
|
newInstallationNode.Expanded = true;
|
|
foreach (var installation2 in installation2s)
|
|
{
|
|
TreeNode newInstallationNode2 = new TreeNode();
|
|
newInstallationNode2.Text = installation2.InstallationName;
|
|
newInstallationNode2.NodeID = installation2.InstallationId;
|
|
newInstallationNode2.CommandName = "installation";
|
|
newInstallationNode2.EnableExpandEvent = true;
|
|
newInstallationNode.Nodes.Add(newInstallationNode2);
|
|
if (installation2.InstallationId == pInstallationId)
|
|
{
|
|
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)
|
|
{
|
|
TreeNode newInstallationNode3 = new TreeNode();
|
|
newInstallationNode3.Text = installation3.InstallationName;
|
|
newInstallationNode3.NodeID = installation3.InstallationId;
|
|
newInstallationNode3.CommandName = "installation";
|
|
newInstallationNode3.EnableExpandEvent = true;
|
|
newInstallationNode2.Nodes.Add(newInstallationNode3);
|
|
if (installation3.InstallationId == InstallationId)
|
|
{
|
|
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)
|
|
{
|
|
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))
|
|
{
|
|
//加载专业下的单位工程
|
|
if (cnProfession.CnProfessionId == CnProfessionId)
|
|
{
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNodeUnitPorject.Nodes.Add(emptyNode);
|
|
}
|
|
else
|
|
{
|
|
#region 不存在子单位工程
|
|
if (wbsSetParm != null)
|
|
{
|
|
if (wbsSetParm.UnitProjectId != UnitProjectId)
|
|
{
|
|
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)
|
|
{
|
|
foreach (var wbsSet1 in wbsSet1s)
|
|
{
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
if (BLL.WbsSetService.IsExitWbsSetById2(wbsSet1.WbsSetId, wbsSetParm.WbsSetId))
|
|
{
|
|
|
|
foreach (var wbsSet2 in childWbsSets2)
|
|
{
|
|
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
|
|
{
|
|
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))
|
|
{
|
|
newwbsSet2Node.Expanded = true;
|
|
if (childWbsSets3.Count() > 0)
|
|
{
|
|
foreach (var wbsSet3 in childWbsSets3)
|
|
{
|
|
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)
|
|
{
|
|
var childWbsSets4 = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(newwbsSet3Node.NodeID);
|
|
if (BLL.WbsSetService.IsExitWbsSetById2(wbsSet3.WbsSetId, wbsSetParm.WbsSetId))
|
|
{
|
|
newwbsSet3Node.Expanded = true;
|
|
if (childWbsSets4.Count() > 0)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (childWbsSets4.Count() > 0)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet3Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (childWbsSets3.Count() > 0)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet2Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet1Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
else //单位工程下直接是分项内容,如质量行为
|
|
{
|
|
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)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNodeUnitPorject.Nodes.Add(emptyNode);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newCnProfessionNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newCnProfessionNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newInstallationNode3.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newInstallationNode2.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
else //总图
|
|
{
|
|
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)
|
|
{
|
|
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
|
|
{
|
|
if (wbsSetParm != null)
|
|
{
|
|
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)
|
|
{
|
|
foreach (var wbsSet1 in wbsSet1s)
|
|
{
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
needAddTempNode = true;
|
|
break;
|
|
}
|
|
}
|
|
if (needAddTempNode)
|
|
{
|
|
var childWbsSets2 = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(newwbsSet1Node.NodeID);
|
|
if (childWbsSets2.Count() > 0)
|
|
{
|
|
if (BLL.WbsSetService.IsExitWbsSetById2(wbsSet1.WbsSetId, wbsSetParm.WbsSetId))
|
|
{
|
|
|
|
foreach (var wbsSet2 in childWbsSets2)
|
|
{
|
|
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
|
|
{
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
foreach (var wbsSet3 in childWbsSets3)
|
|
{
|
|
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);
|
|
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)
|
|
{
|
|
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)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (childWbsSets4.Count() > 0)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet3Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (childWbsSets3.Count() > 0)
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet2Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newwbsSet1Node.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
else //单位工程下直接是分项内容,如质量行为
|
|
{
|
|
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)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newNodeUnitPorject.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TreeNode emptyNode = new TreeNode();
|
|
emptyNode.Text = "";
|
|
emptyNode.NodeID = "";
|
|
newInstallationNode.Nodes.Add(emptyNode);
|
|
}
|
|
}
|
|
}
|
|
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;
|
|
this.btnAdd.Hidden = false;
|
|
this.btnMenuCopy.Hidden = false;
|
|
//this.btnMenuDetail.Hidden = false;
|
|
//this.btnMenuWeekDetail.Hidden = false;
|
|
//this.btnMenuCopy2.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
{
|
|
this.btnMenuEdit.Hidden = false;
|
|
this.btnMenuModify.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
{
|
|
this.btnMenuDelete.Hidden = false;
|
|
this.btnMenuDel.Hidden = false;
|
|
}
|
|
//if (buttonList.Contains(BLL.Const.BtnAuditing))
|
|
//{
|
|
// this.btnMenuAudit.Hidden = false;
|
|
//}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |