项目删除节点
This commit is contained in:
parent
e688f6ec45
commit
d3116638f6
|
@ -9,6 +9,7 @@ using System.Web.UI.WebControls;
|
||||||
using BLL;
|
using BLL;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Model;
|
using Model;
|
||||||
|
using FineUIPro.Web.BaseInfo;
|
||||||
|
|
||||||
namespace FineUIPro.Web.ProjectData
|
namespace FineUIPro.Web.ProjectData
|
||||||
{
|
{
|
||||||
|
@ -313,45 +314,72 @@ namespace FineUIPro.Web.ProjectData
|
||||||
{
|
{
|
||||||
string id = this.trProjects.SelectedNode.NodeID;
|
string id = this.trProjects.SelectedNode.NodeID;
|
||||||
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
Model.Project_Installation installation = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
||||||
if (installation.SuperInstallationId == "0") //删除一级装置
|
if (installation != null)
|
||||||
{
|
{
|
||||||
if (installation.InstallationName == "总图")
|
ShowNotify("已关联项目无法删除!", MessageBoxIcon.Warning);
|
||||||
{
|
return;
|
||||||
DeleteZTData(installation.InstallationId);
|
|
||||||
}
|
}
|
||||||
else
|
var cnProfession = Funs.DB.WBS_CnProfession.FirstOrDefault(x => x.InstallationId == id);
|
||||||
|
if (cnProfession != null)
|
||||||
{
|
{
|
||||||
|
ShowNotify("已关联专业无法删除!", MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var unitWorks = (from x in Funs.DB.WBS_UnitWork where x.InstallationId == id select x).ToList();
|
||||||
|
if (unitWorks != null)
|
||||||
|
{
|
||||||
|
ShowNotify("已关联单位工程无法删除!", MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var workArea = (from x in Funs.DB.ProjectData_WorkArea where x.InstallationId == id select x).ToList();
|
||||||
|
if (workArea != null)
|
||||||
|
{
|
||||||
|
ShowNotify("已关联施工区域无法删除!", MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (installation.SuperInstallationId == "0") //删除一级装置
|
||||||
|
//{
|
||||||
|
// if (installation.InstallationName == "总图")
|
||||||
|
// {
|
||||||
|
// DeleteZTData(installation.InstallationId);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// BLL.Project_InstallationService.DeleteInstallation(id);
|
||||||
|
// var installation2s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == id select x;
|
||||||
|
// foreach (var installation2 in installation2s)
|
||||||
|
// {
|
||||||
|
// BLL.Project_InstallationService.DeleteInstallation(installation2.InstallationId);
|
||||||
|
// var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation2.InstallationId select x;
|
||||||
|
// foreach (var installation3 in installation3s)
|
||||||
|
// {
|
||||||
|
// DeleteData(installation3.InstallationId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Model.Project_Installation installation2 = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
||||||
|
// Model.Project_Installation installation1 = BLL.Project_InstallationService.GetInstallationByInstallationId(installation2.SuperInstallationId);
|
||||||
|
// if (installation1.SuperInstallationId == "0") //删除二级装置
|
||||||
|
// {
|
||||||
|
// BLL.Project_InstallationService.DeleteInstallation(id);
|
||||||
|
// var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == id select x;
|
||||||
|
// foreach (var installation3 in installation3s)
|
||||||
|
// {
|
||||||
|
// DeleteData(installation3.InstallationId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else //删除二级装置
|
||||||
|
// {
|
||||||
|
// DeleteData(id);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
BLL.Project_InstallationService.DeleteInstallation(id);
|
BLL.Project_InstallationService.DeleteInstallation(id);
|
||||||
var installation2s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == id select x;
|
|
||||||
foreach (var installation2 in installation2s)
|
|
||||||
{
|
|
||||||
BLL.Project_InstallationService.DeleteInstallation(installation2.InstallationId);
|
|
||||||
var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == installation2.InstallationId select x;
|
|
||||||
foreach (var installation3 in installation3s)
|
|
||||||
{
|
|
||||||
DeleteData(installation3.InstallationId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Model.Project_Installation installation2 = BLL.Project_InstallationService.GetInstallationByInstallationId(id);
|
|
||||||
Model.Project_Installation installation1 = BLL.Project_InstallationService.GetInstallationByInstallationId(installation2.SuperInstallationId);
|
|
||||||
if (installation1.SuperInstallationId == "0") //删除二级装置
|
|
||||||
{
|
|
||||||
BLL.Project_InstallationService.DeleteInstallation(id);
|
|
||||||
var installation3s = from x in Funs.DB.Project_Installation where x.SuperInstallationId == id select x;
|
|
||||||
foreach (var installation3 in installation3s)
|
|
||||||
{
|
|
||||||
DeleteData(installation3.InstallationId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //删除二级装置
|
|
||||||
{
|
|
||||||
DeleteData(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
||||||
InitTreeMenu();
|
InitTreeMenu();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue