89 lines
3.5 KiB
C#
89 lines
3.5 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HJGL.BaseInfo
|
|
{
|
|
public partial class MaterialCodeLibEdit : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
string materialCode = Request.Params["MaterialCode"];
|
|
if (!string.IsNullOrEmpty(materialCode))
|
|
{
|
|
Model.HJGL_MaterialCodeLib lib = BLL.MaterialCodeLibService.GetMaterialCodeLib(materialCode);
|
|
if (lib != null)
|
|
{
|
|
this.txtMaterialCode.Text = materialCode;
|
|
this.txtMaterialMade.Text = lib.MaterialMade;
|
|
this.txtMaterialName.Text = lib.MaterialName;
|
|
txtMaterialSpec.Text = lib.MaterialSpec;
|
|
txtMaterialDef.Text = lib.MaterialDef;
|
|
txtMaterialUnit.Text = lib.MaterialUnit;
|
|
txtMaterialCode.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
txtMaterialCode.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
string materialCode = Request.Params["MaterialCode"];
|
|
if (string.IsNullOrEmpty(materialCode))
|
|
{
|
|
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == this.txtMaterialCode.Text.Trim());
|
|
if (q != null)
|
|
{
|
|
Alert.ShowInTop("此材料编码已存在!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
Model.HJGL_MaterialCodeLib newLib = new Model.HJGL_MaterialCodeLib
|
|
{
|
|
MaterialCode = this.txtMaterialCode.Text.Trim(),
|
|
MaterialName = this.txtMaterialName.Text.Trim(),
|
|
MaterialSpec = this.txtMaterialSpec.Text.Trim(),
|
|
MaterialMade = this.txtMaterialMade.Text.Trim(),
|
|
MaterialDef = this.txtMaterialDef.Text.Trim(),
|
|
MaterialUnit = txtMaterialUnit.Text.Trim()
|
|
};
|
|
|
|
if (!string.IsNullOrEmpty(materialCode))
|
|
{
|
|
BLL.MaterialCodeLibService.UpdateMaterialCodeLib(newLib);
|
|
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipingClassMenuId, Const.BtnModify, newPipingClass.PipingClassId);
|
|
}
|
|
else
|
|
{
|
|
|
|
BLL.MaterialCodeLibService.AddMaterialCodeLib(newLib);
|
|
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipingClassMenuId, Const.BtnAdd, newPipingClass.PipingClassId);
|
|
}
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
}
|
|
} |