175 lines
9.5 KiB
C#
175 lines
9.5 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
{
|
|
public partial class UnitWorkEdit : PageBase
|
|
{
|
|
private static string superId;
|
|
private static string id;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
superId = Request.Params["SuperId"];
|
|
if (!string.IsNullOrEmpty(superId) && superId != null)
|
|
{
|
|
this.txtUnitWorkCode.Hidden = false;
|
|
this.txtUnitWorkName.Hidden = false;
|
|
Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId);
|
|
if (supUnitWork != null)
|
|
{
|
|
this.txtSupUnitWorkCode.Text = supUnitWork.UnitWorkCode;
|
|
this.txtSupUnitWorkName.Text = supUnitWork.UnitWorkName;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtUnitWorkCode.Hidden = true;
|
|
this.txtUnitWorkName.Hidden = true;
|
|
}
|
|
id = Request.Params["Id"];
|
|
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(id);
|
|
if (unitWork != null)
|
|
{
|
|
if (unitWork.SuperUnitWork == "0")
|
|
{
|
|
this.txtUnitWorkCode.Hidden = true;
|
|
this.txtUnitWorkName.Hidden = true;
|
|
this.txtSupUnitWorkCode.Text = unitWork.UnitWorkCode;
|
|
this.txtSupUnitWorkName.Text = unitWork.UnitWorkName;
|
|
}
|
|
else
|
|
{
|
|
this.txtUnitWorkCode.Hidden = false;
|
|
this.txtUnitWorkName.Hidden = false;
|
|
Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(unitWork.SuperUnitWork);
|
|
if (supUnitWork != null)
|
|
{
|
|
this.txtSupUnitWorkCode.Text = supUnitWork.UnitWorkCode;
|
|
this.txtSupUnitWorkName.Text = supUnitWork.UnitWorkName;
|
|
}
|
|
this.txtUnitWorkCode.Text = unitWork.UnitWorkCode;
|
|
this.txtUnitWorkName.Text = unitWork.UnitWorkName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(superId) && superId != null)
|
|
{
|
|
Model.WBS_UnitWork supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId);
|
|
if (supUnitWork != null)
|
|
{
|
|
Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork();
|
|
newUnitWork.UnitWorkCode = this.txtUnitWorkCode.Text.Trim();
|
|
newUnitWork.UnitWorkName = this.txtUnitWorkName.Text.Trim();
|
|
newUnitWork.SuperUnitWork = superId;
|
|
newUnitWork.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newUnitWork.UnitWorkId = id;
|
|
BLL.UnitWorkService.UpdateUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改子单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork));
|
|
BLL.UnitWorkService.AddUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加子单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newUnitWork.UnitWorkId) + ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork();
|
|
newUnitWork.UnitWorkCode = this.txtSupUnitWorkCode.Text.Trim();
|
|
newUnitWork.UnitWorkName = this.txtSupUnitWorkName.Text.Trim();
|
|
newUnitWork.SuperUnitWork = "0";
|
|
newUnitWork.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newUnitWork.UnitWorkId = id;
|
|
BLL.UnitWorkService.UpdateUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork));
|
|
BLL.UnitWorkService.AddUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); //PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newUnitWork.UnitWorkId) + ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Model.WBS_UnitWork newUnitWork = new Model.WBS_UnitWork();
|
|
newUnitWork.UnitWorkCode = this.txtSupUnitWorkCode.Text.Trim();
|
|
newUnitWork.UnitWorkName = this.txtSupUnitWorkName.Text.Trim();
|
|
newUnitWork.SuperUnitWork = "0";
|
|
newUnitWork.ProjectId = this.CurrUser.LoginProjectId;
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
newUnitWork.UnitWorkId = id;
|
|
BLL.UnitWorkService.UpdateUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "修改单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
else
|
|
{
|
|
newUnitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork));
|
|
BLL.UnitWorkService.AddUnitWork(newUnitWork);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, newUnitWork.UnitWorkId, newUnitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!");
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());//PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newUnitWork.UnitWorkId) + ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
}
|
|
//string projectId = string.Empty;
|
|
//string superUnitWorkId = string.Empty;
|
|
//Model.WBS_UnitWork unitWork = new Model.WBS_UnitWork();
|
|
//Model.Base_Project project = BLL.ProjectService.GetProjectByProjectId(superId);
|
|
//Model.WBS_UnitWork parUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(superId);
|
|
//if (project != null)
|
|
//{
|
|
// projectId = project.ProjectId;
|
|
// superUnitWorkId = "0";
|
|
// unitWork.UnitWorkCode = txtSupUnitWorkCode.Text.Trim();
|
|
// unitWork.UnitWorkName = txtSupUnitWorkName.Text.Trim();
|
|
// unitWork.SuperUnitWork = superUnitWorkId;
|
|
//}
|
|
//else if (parUnitWork != null)
|
|
//{
|
|
// projectId = parUnitWork.ProjectId;
|
|
// superUnitWorkId = superId;
|
|
// unitWork.UnitWorkCode = txtUnitWorkCode.Text.Trim();
|
|
// unitWork.UnitWorkName = txtUnitWorkName.Text.Trim();
|
|
// unitWork.SuperUnitWork = superUnitWorkId;
|
|
//}
|
|
//unitWork.ProjectId = projectId;
|
|
//if (string.IsNullOrEmpty(id))
|
|
//{
|
|
// unitWork.UnitWorkId = SQLHelper.GetNewID(typeof(Model.WBS_UnitWork));
|
|
// BLL.UnitWorkService.AddUnitWork(unitWork);
|
|
|
|
// BLL.LogService.AddSys_Log(this.CurrUser, unitWork.UnitWorkId, unitWork.UnitWorkId, BLL.Const.UnitWorkMenuId, "增加单位工程!");
|
|
// PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(unitWork.UnitWorkId) + ActiveWindow.GetHidePostBackReference());
|
|
//}
|
|
//else
|
|
//{
|
|
// 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());
|
|
//}
|
|
}
|
|
}
|
|
} |