20230829 wbs拷贝单位工程下勾选状态
This commit is contained in:
@@ -1374,5 +1374,86 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 拷贝单位工程下勾选状态
|
||||
/// <summary>
|
||||
/// 拷贝单位工程下勾选状态
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.trWBS.SelectedNode != null)
|
||||
{
|
||||
string unitWorkId = string.Empty;
|
||||
var newUnitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.trWBS.SelectedNode.NodeID);
|
||||
if (newUnitWork != null)
|
||||
{
|
||||
unitWorkId = newUnitWork.UnitWorkId;
|
||||
}
|
||||
else
|
||||
{
|
||||
var div = BLL.DivisionProjectService.GetDivisionProjectById(this.trWBS.SelectedNode.NodeID);
|
||||
if (div != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(div.UnitWorkId))
|
||||
{
|
||||
unitWorkId = div.UnitWorkId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var div2 = (from x in Funs.DB.WBS_DivisionProject where x.CNProfessionalId != null && x.CNProfessionalId == this.trWBS.SelectedNodeID select x).FirstOrDefault();
|
||||
if (div2 != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(div2.UnitWorkId))
|
||||
{
|
||||
unitWorkId = div2.UnitWorkId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var nodeId = this.trWBS.SelectedNodeID.Split('|')[0];
|
||||
var uw = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(nodeId);
|
||||
if (uw != null)
|
||||
{
|
||||
unitWorkId = uw.UnitWorkId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var unitWork = (from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId != unitWorkId
|
||||
select x).FirstOrDefault();
|
||||
|
||||
var oldDivsionProject = (from x in Funs.DB.WBS_DivisionProject
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.IsSelected == true
|
||||
&& x.UnitWorkId == unitWork.UnitWorkId
|
||||
select x).ToList();
|
||||
foreach (var item in oldDivsionProject)
|
||||
{
|
||||
var div = Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitWorkId && x.DivisionCode == item.DivisionCode);
|
||||
if (div != null)
|
||||
{
|
||||
div.IsSelected = true;
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
var breakdownProjects = (from x in Funs.DB.WBS_BreakdownProject
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.UnitWorkId == unitWorkId
|
||||
&& x.DivisionProjectId == div.DivisionProjectId
|
||||
select x).ToList();
|
||||
foreach (var b in breakdownProjects)
|
||||
{
|
||||
b.IsSelected = true;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowNotify("拷贝成功", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user