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

90 lines
3.8 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class PrePipelineBatchEdit : 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 pipelineId = Request.Params["PipelineId"];
if (!string.IsNullOrEmpty(pipelineId))
{
var pipe = BLL.PipelineService.GetPipelineByPipelineId(pipelineId);
lbPipelineCode.Text = pipe.PipelineCode;
txtCodePrefix.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))
{
int startInt = Funs.GetNewIntOrZero(this.txtCodeStart.Text.Trim());
int endInt = Funs.GetNewIntOrZero(this.txtCodeEnd.Text.Trim());
if (endInt < startInt)
{
Alert.ShowInTop("止数应大于等于起数", MessageBoxIcon.Warning);
return;
}
for (int i = startInt; i <= endInt; i++)
{
string last = string.Empty;
if (i < 10)
{
last = "00" + Convert.ToString(i);
}
else if (i >= 10 && i < 99)
{
last = "0" + Convert.ToString(i);
}
else
{
last = Convert.ToString(i);
}
string pipelineComponentCode = txtCodePrefix.Text + last;
if (BLL.HJGL_PipelineComponentService.IsExistPipelineComponentCode(pipelineComponentCode, hdPipelineId.Text, null))
{
Alert.ShowInTop("该预制管线组件编号已存在!", MessageBoxIcon.Warning);
return;
}
else
{
Model.HJGL_Pipeline_Component pipeline = new Model.HJGL_Pipeline_Component();
string pipelineComponentId = SQLHelper.GetNewID(typeof(Model.HJGL_Pipeline_Component));
pipeline.PipelineComponentId = pipelineComponentId;
pipeline.PipelineComponentCode = pipelineComponentCode;
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.BoxNumber = this.txtBoxNumber.Text.Trim();
pipeline.PipelineId = hdPipelineId.Text;
BLL.HJGL_PipelineComponentService.AddPipelineComponent(pipeline);
}
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
}
}