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

111 lines
4.6 KiB
C#
Raw Normal View History

2022-09-05 16:36:31 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class PackagingManageEdit : PageBase
{
public string PackagingManageId
{
get
{
return (string)ViewState["PackagingManageId"];
}
set
{
ViewState["PackagingManageId"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PackagingManageId = Request.Params["PackagingManageId"];
HJGL_PipelineComponentService.InitPipelineDownList(drpPipelineComponentCode, this.CurrUser.LoginProjectId, false);
HJGL_PackagingmanageService.InitPipelineDownList(txtPackagingCode, this.CurrUser.LoginProjectId, false);
2022-09-18 23:22:47 +08:00
btnClose.OnClientClick = ActiveWindow.GetHideReference();
2022-09-05 16:36:31 +08:00
if (!string.IsNullOrEmpty(PackagingManageId))
{
var model = HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
txtPackagingCode.SelectedValue = model.PackagingCode;
drpPipelineComponentCode.SelectedValueArray = model.PipelineComponentId.Split(',');
txtStackingPosition.Text = model.StackingPosition;
txtContactName.Text = model.ContactName;
txtContactPhone.Text = model.ContactPhone;
if (model.State== HJGL_PackagingmanageService.state_0)
{
btnSave.Hidden = false;
}
}
else
2022-09-18 23:22:47 +08:00
{btnSave.Hidden = false;
2022-09-05 16:36:31 +08:00
txtPackagingCode.Text = ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId)+"-"+ string.Format("{0:yyyyMMdd}", DateTime.Now)+"-";
}
}
}
protected void drpPipelineComponentCode_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string .IsNullOrEmpty(drpPipelineComponentCode.SelectedValue))
{
var model_Component = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(drpPipelineComponentCode.SelectedValue);
var model_pipe=BLL.PipelineService.GetPipelineByPipelineId(model_Component.PipelineId);
txtPlanStartDate.Text= model_Component.PlanStartDate.ToString();
}
else
{
txtPlanStartDate.Text =String.Empty;
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(drpPipelineComponentCode.SelectedValue))
{
ShowNotify("请选择预制组件", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(PackagingManageId))
{
Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage() ;
table.PackagingManageId = SQLHelper.GetNewID();
table.PackagingCode = txtPackagingCode.Text;
table.ProjectId = this.CurrUser.LoginProjectId;
table.PipelineComponentId = string.Join(",", drpPipelineComponentCode.SelectedValueArray);
table.StackingPosition = txtStackingPosition.Text;
table.State = 0;
table.ContactName = txtContactName.Text;
table.ContactPhone = txtContactPhone.Text;
BLL.HJGL_PackagingmanageService.AddHJGL_PackagingManage(table);
}
else
{
Model.HJGL_PackagingManage table = BLL.HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
if (table != null)
{
table.PackagingCode = txtPackagingCode.Text;
table.ProjectId = this.CurrUser.LoginProjectId;
table.PipelineComponentId = string.Join(",", drpPipelineComponentCode.SelectedValueArray);
table.StackingPosition = txtStackingPosition.Text ;
table.State = 0;
table.ContactName = txtContactName.Text;
table.ContactPhone =txtContactPhone.Text;
}
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
}
}