Files
SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/BaseInfo/PaintCodeDictEdit.aspx.cs
T
lpf d090c174b9 feat(hjgl): 新增防腐等级字典管理
将防腐等级维护纳入焊接设置菜单,便于统一维护防腐等级编码并复用系统权限配置。
2026-09-16 15:48:32 +08:00

75 lines
2.5 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.HJGL.BaseInfo
{
public partial class PaintCodeDictEdit : PageBase
{
private string PaintCodeDictId
{
get { return (string)ViewState["PaintCodeDictId"]; }
set { ViewState["PaintCodeDictId"] = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
PaintCodeDictId = Request.Params["Id"];
if (!string.IsNullOrEmpty(PaintCodeDictId))
{
BindForm();
}
}
}
private void BindForm()
{
var model = PaintCodeDictService.GetById(PaintCodeDictId);
txtPaintCode.Text = model.PaintCode;
txtPrimer.Text = model.Primer;
txtIntermediatePaint.Text = model.IntermediatePaint;
txtTopcoat.Text = model.Topcoat;
txtColorCode.Text = model.ColorCode;
txtSortIndex.Text = model.SortIndex.HasValue ? model.SortIndex.Value.ToString() : string.Empty;
chkIsUsed.Checked = model.IsUsed;
}
protected void btnSave_Click(object sender, EventArgs e)
{
string paintCode = txtPaintCode.Text.Trim();
if (PaintCodeDictService.PaintCodeExists(paintCode, PaintCodeDictId))
{
Alert.ShowInTop("此防腐等级已存在", MessageBoxIcon.Warning);
return;
}
var model = new Model.Tw_PaintCodeDict
{
Id = PaintCodeDictId,
PaintCode = paintCode,
Primer = txtPrimer.Text.Trim(),
IntermediatePaint = txtIntermediatePaint.Text.Trim(),
Topcoat = txtTopcoat.Text.Trim(),
ColorCode = txtColorCode.Text.Trim(),
SortIndex = string.IsNullOrEmpty(txtSortIndex.Text) ? (int?)null : Convert.ToInt32(txtSortIndex.Text),
IsUsed = chkIsUsed.Checked
};
if (string.IsNullOrEmpty(PaintCodeDictId))
{
model.Id = SQLHelper.GetNewID();
PaintCodeDictService.Add(model);
}
else
{
PaintCodeDictService.Update(model);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}