20240805 单位工程设置修改

This commit is contained in:
2024-08-05 16:16:22 +08:00
parent 6feffba060
commit 83340dd172
26 changed files with 652 additions and 921 deletions
+8 -2
View File
@@ -42,12 +42,18 @@
ShowSelectedCell="true" DataIDField="UnitWorkId" AllowPaging="true" IsDatabasePaging="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" AllowFilters="true" OnFilterChange="Grid1_FilterChange">
<Columns>
<f:RenderField Width="150px" ColumnID="UnitWorkCode" DataField="UnitWorkCode" FieldType="String"
<f:RenderField Width="150px" ColumnID="SupUnitWorkCode" DataField="SupUnitWorkCode" FieldType="String"
HeaderText="单位工程编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="UnitWorkName" DataField="UnitWorkName" FieldType="String"
<f:RenderField Width="200px" ColumnID="SupUnitWorkName" DataField="SupUnitWorkName" FieldType="String"
HeaderText="单位工程名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="UnitWorkCode" DataField="UnitWorkCode" FieldType="String"
HeaderText="子单位工程编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="UnitWorkName" DataField="UnitWorkName" FieldType="String"
HeaderText="子单位工程名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
</Columns>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
+50 -15
View File
@@ -235,7 +235,15 @@ namespace FineUIPro.Web.ProjectData
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.UnitWorkMenuId, BLL.Const.BtnModify))
{
this.hdSelectId.Text = this.trProjects.SelectedNode.NodeID;
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UnitWorkEdit.aspx?Id={0}", this.trProjects.SelectedNode.NodeID, "编辑 - ")));
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(this.hdSelectId.Text);
if (unitWork!=null)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UnitWorkEdit.aspx?Id={0}&&SuperId={1}", this.trProjects.SelectedNode.NodeID,unitWork.SuperUnitWork, "编辑 - ")));
}
else
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("UnitWorkEdit.aspx?Id={0}", this.trProjects.SelectedNode.NodeID, "编辑 - ")));
}
}
else
{
@@ -259,10 +267,24 @@ namespace FineUIPro.Web.ProjectData
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.UnitWorkMenuId, BLL.Const.BtnAdd))
{
string openUrl = String.Format("UnitWorkEdit.aspx?SuperId={0}", this.trProjects.SelectedNode.NodeID, "增加 - ");
string id = this.trProjects.SelectedNode.NodeID;
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
+ Window2.GetShowReference(openUrl));
if (id != null)
{
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(id);
if (unitWork != null)
{
string openUrl = String.Format("UnitWorkEdit.aspx?SuperId={0}", this.trProjects.SelectedNode.NodeID, "增加 - ");
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
+ Window2.GetShowReference(openUrl));
}
else
{
string openUrl = String.Format("UnitWorkEdit.aspx", "增加 - ");
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdSelectId.ClientID)
+ Window2.GetShowReference(openUrl));
}
}
}
else
{
@@ -275,8 +297,6 @@ namespace FineUIPro.Web.ProjectData
}
}
/// <summary>
/// 右键删除事件
/// </summary>
@@ -389,20 +409,35 @@ namespace FineUIPro.Web.ProjectData
/// </summary>
private void BindGrid()
{
List<Model.WBS_UnitWork> items = new List<Model.WBS_UnitWork>();
List<Model.UnitWork> items = new List<Model.UnitWork>();
if (this.trProjects.SelectedNode != null)
{
if (this.trProjects.SelectedNode.CommandName == "unitWork")
{
Model.WBS_UnitWork installation = BLL.UnitWorkService.getUnitWorkByUnitWorkId(this.trProjects.SelectedNode.NodeID);
Model.WBS_UnitWork item = new Model.WBS_UnitWork();
if (installation != null)
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(this.trProjects.SelectedNode.NodeID);
if (unitWork != null)
{
item.UnitWorkId = installation.UnitWorkId;
item.UnitWorkCode = installation.UnitWorkCode;
item.UnitWorkName = installation.UnitWorkName;
//item.ProjectType = "unitWork";
items.Add(item);
Model.UnitWork item = new Model.UnitWork();
if (unitWork.SuperUnitWork == "0")
{
item.UnitWorkId = unitWork.UnitWorkId;
item.SupUnitWorkCode = unitWork.UnitWorkCode;
item.SupUnitWorkName = unitWork.UnitWorkName;
items.Add(item);
}
else
{
item.UnitWorkId = unitWork.UnitWorkId;
var supUnitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(unitWork.SuperUnitWork);
if (supUnitWork != null)
{
item.SupUnitWorkCode = supUnitWork.UnitWorkCode;
item.SupUnitWorkName = supUnitWork.UnitWorkName;
}
item.UnitWorkCode = unitWork.UnitWorkCode;
item.UnitWorkName = unitWork.UnitWorkName;
items.Add(item);
}
}
}
this.Grid1.DataSource = items;
@@ -15,12 +15,22 @@
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtUnitWorkCode" runat="server" Label="单位工程编号" LabelWidth="140px" Required="true" ShowRedStar="true" FocusOnPageLoad="true"></f:TextBox>
<f:TextBox ID="txtSupUnitWorkCode" runat="server" Label="单位工程编号" LabelWidth="140px" Required="true" ShowRedStar="true" FocusOnPageLoad="true"></f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtUnitWorkName" runat="server" Label="单位工程名称" LabelWidth="140px" Required="true" ShowRedStar="true"></f:TextBox>
<f:TextBox ID="txtSupUnitWorkName" runat="server" Label="单位工程名称" LabelWidth="140px" Required="true" ShowRedStar="true"></f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtUnitWorkCode" runat="server" Label="子单位工程编号" LabelWidth="140px" ></f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtUnitWorkName" runat="server" Label="子单位工程名称" LabelWidth="140px" ></f:TextBox>
</Items>
</f:FormRow>
</Rows>
@@ -13,57 +13,163 @@ namespace FineUIPro.Web.ProjectData
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)
{
this.txtUnitWorkCode.Text = unitWork.UnitWorkCode;
this.txtUnitWorkName.Text = unitWork.UnitWorkName;
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)
{
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)
if (!string.IsNullOrEmpty(superId) && superId != null)
{
projectId = project.ProjectId;
superUnitWorkId = "0";
}
else if (parUnitWork != null)
{
projectId = parUnitWork.ProjectId;
superUnitWorkId = superId;
}
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))
{
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());
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 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());
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());
//}
}
}
}
@@ -39,6 +39,24 @@ namespace FineUIPro.Web.ProjectData {
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtSupUnitWorkCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSupUnitWorkCode;
/// <summary>
/// txtSupUnitWorkName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSupUnitWorkName;
/// <summary>
/// txtUnitWorkCode 控件。
/// </summary>