2021-04-30 10:28:37 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
|
|
|
{
|
|
|
|
|
public partial class UnitWorkEdit : PageBase
|
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
private static string superId;
|
|
|
|
|
private static string id;
|
|
|
|
|
|
2021-04-30 10:28:37 +08:00
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
superId = Request.Params["SuperId"];
|
|
|
|
|
id = Request.Params["Id"];
|
|
|
|
|
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(id);
|
|
|
|
|
if (unitWork != null)
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
this.txtUnitWorkCode.Text = unitWork.UnitWorkCode;
|
|
|
|
|
this.txtUnitWorkName.Text = unitWork.UnitWorkName;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
string projectId = string.Empty;
|
|
|
|
|
string superUnitWorkId = string.Empty;
|
|
|
|
|
Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(superId);
|
|
|
|
|
Model.WBS_UnitWork parUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId);
|
|
|
|
|
if (project != null)
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
projectId = project.ProjectId;
|
|
|
|
|
superUnitWorkId = "0";
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
2024-07-29 23:00:57 +08:00
|
|
|
|
else if (parUnitWork != null)
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
projectId = parUnitWork.ProjectId;
|
|
|
|
|
superUnitWorkId = superId;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 23:00:57 +08:00
|
|
|
|
Model.WBS_UnitWork unitWork = new Model.WBS_UnitWork();
|
|
|
|
|
unitWork.UnitWorkCode = txtUnitWorkCode.Text.Trim();
|
|
|
|
|
unitWork.UnitWorkName = txtUnitWorkName.Text.Trim();
|
|
|
|
|
unitWork.ProjectId = projectId;
|
|
|
|
|
unitWork.SuperUnitWork = superUnitWorkId;
|
|
|
|
|
if (string.IsNullOrEmpty(id))
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
unitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork));
|
|
|
|
|
BLL.UnitWorkService.AddUnitWork(unitWork);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
|
2024-07-29 23:00:57 +08:00
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, unitWork.UnitWorkId, unitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!");
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(unitWork.UnitWorkId) + ActiveWindow.GetHidePostBackReference());
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
2024-07-29 23:00:57 +08:00
|
|
|
|
else
|
2021-04-30 10:28:37 +08:00
|
|
|
|
{
|
2024-07-29 23:00:57 +08:00
|
|
|
|
Model.WBS_UnitWork unitWork1 = BLL.UnitWorkService.getUnitWorkByUnitWorkId(id);
|
|
|
|
|
unitWork.UnitWorkId = id;
|
|
|
|
|
unitWork.ProjectId = unitWork1.ProjectId;
|
|
|
|
|
unitWork.SuperUnitWork = unitWork1.SuperUnitWork;
|
|
|
|
|
BLL.UnitWorkService.UpdateUnitWork(unitWork);
|
|
|
|
|
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, unitWork.UnitWorkId, unitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改单位工程!");
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|