SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineEdit.aspx.cs

101 lines
4.6 KiB
C#
Raw Normal View History

2022-09-05 16:36:31 +08:00
using BLL;
using System;
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class PrePipelineEdit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpPreUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpAssembleUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
string pipelineComponentId = Request.Params["PipelineComponentId"];
if (!string.IsNullOrEmpty(pipelineComponentId))
{
var com = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(pipelineComponentId);
if (com != null)
{
var pipe = BLL.PipelineService.GetPipelineByPipelineId(com.PipelineId);
var mat = BLL.PipelineMatService.GetPipeLineMat(com.PipeLineMatId);
lbPipelineCode.Text = pipe.PipelineCode;
txtPipelineComponentCode.Text = com.PipelineComponentCode;
txtBoxNumber.Text = com.BoxNumber;
if (!string.IsNullOrEmpty(com.PreUnit))
{
drpPreUnit.SelectedValue = com.PreUnit;
}
if (!string.IsNullOrEmpty(com.AssembleUnit))
{
drpAssembleUnit.SelectedValue = com.AssembleUnit;
}
hdPipelineId.Text = com.PipelineId;
}
}
else
{
string pipelineId = Request.Params["PipelineId"];
if (!string.IsNullOrEmpty(pipelineId))
{
var pipe = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
lbPipelineCode.Text = pipe.PipelineCode;
txtPipelineComponentCode.Text = pipe.PipelineCode + "-";
hdPipelineId.Text = pipelineId;
}
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PrePipelineMenuId, Const.BtnSave))
{
if (BLL.HJGL_PipelineComponentService.IsExistPipelineComponentCode(this.txtPipelineComponentCode.Text.Trim(), hdPipelineId.Text, Request.Params["PipelineComponentId"]))
{
Alert.ShowInTop("该预制管线组件编号已存在!", MessageBoxIcon.Warning);
return;
}
else
{
Model.HJGL_Pipeline_Component pipeline = new Model.HJGL_Pipeline_Component();
if (this.drpPreUnit.SelectedValue != BLL.Const._Null)
{
pipeline.PreUnit = this.drpPreUnit.SelectedValue;
}
if (this.drpAssembleUnit.SelectedValue != BLL.Const._Null)
{
pipeline.AssembleUnit = this.drpAssembleUnit.SelectedValue;
}
pipeline.PipelineComponentCode = this.txtPipelineComponentCode.Text.Trim();
pipeline.BoxNumber = this.txtBoxNumber.Text.Trim();
pipeline.PipelineId = hdPipelineId.Text;
if (!string.IsNullOrEmpty(Request.Params["PipelineComponentId"]))
{
pipeline.PipelineComponentId = Request.Params["PipelineComponentId"];
BLL.HJGL_PipelineComponentService.UpdatePipelineComponent(pipeline);
}
else
{
string pipelineComponentId = SQLHelper.GetNewID(typeof(Model.HJGL_Pipeline_Component));
pipeline.PipelineComponentId = pipelineComponentId;
BLL.HJGL_PipelineComponentService.AddPipelineComponent(pipeline);
}
// 关闭本窗体,然后回发父窗体
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
}
}