SGGL_SHJ/SGGL/FineUIPro.Web/BaseInfo/CompanyModelKindEdit.aspx.cs

75 lines
2.9 KiB
C#
Raw Normal View History

using BLL;
using System;
2023-02-14 17:40:34 +08:00
namespace FineUIPro.Web.BaseInfo
{
public partial class CompanyModelKindEdit : PageBase
{
#region
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.Params["CompanyModelKindId"];
string year = DateTime.Now.Year.ToString();
if (!string.IsNullOrEmpty(Request.Params["type"]))
{
this.btnSave.Hidden = true;
}
if (!string.IsNullOrEmpty(id))
{
Model.Base_CompanyModelKind CompanyModelKind = BLL.CompanyModelKindService.GetCompanyModelKindById(id);
if (CompanyModelKind != null)
{
this.hdId.Text = id;
this.txtCompanyModelKindCode.Text = CompanyModelKind.CompanyModelKindCode;
this.txtCompanyModelKindName.Text = CompanyModelKind.CompanyModelKindName;
this.txtRemark.Text = CompanyModelKind.Remark;
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
string id = Request.Params["CompanyModelKindId"];
Model.Base_CompanyModelKind newCompanyModelKind = new Model.Base_CompanyModelKind();
newCompanyModelKind.CompanyModelKindCode = this.txtCompanyModelKindCode.Text.Trim();
newCompanyModelKind.CompanyModelKindName = this.txtCompanyModelKindName.Text.Trim();
newCompanyModelKind.Remark = this.txtRemark.Text.Trim();
if (!string.IsNullOrEmpty(id))
{
newCompanyModelKind.CompanyModelKindId = id;
BLL.CompanyModelKindService.UpdateCompanyModelKind(newCompanyModelKind);
}
else
{
if (!string.IsNullOrEmpty(this.hdId.Text))
{
newCompanyModelKind.CompanyModelKindId = this.hdId.Text.Trim();
}
else
{
newCompanyModelKind.CompanyModelKindId = SQLHelper.GetNewID(typeof(Model.Base_CompanyModelKind));
this.hdId.Text = newCompanyModelKind.CompanyModelKindId;
}
BLL.CompanyModelKindService.AddCompanyModelKind(newCompanyModelKind);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
}
}