using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace FineUIPro.Web.BaseInfo
{
public partial class CompanyModelKindEdit : PageBase
{
#region 加载
///
/// 页面加载
///
///
///
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 保存
///
/// 保存按钮
///
///
///
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
}
}