SGGL_JT/SUBQHSE/FineUIPro.Web/Customization/CNCCG/HSSE/SubItemEdit.aspx.cs

61 lines
1.8 KiB
C#

using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Linq;
using System.Web;
namespace FineUIPro.Web.Customization.CNCCG.HSSE
{
public partial class SubItemEdit : PageBase
{
public string Id
{
get
{
return (string)ViewState["Id"];
}
set
{
ViewState["Id"] = value;
}
}
public Model.SUBQHSEDB db = Funs.DB;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnClose.OnClientClick = ActiveWindow.GetHideReference();
Id = Request.Params["Id"];
if (!string.IsNullOrEmpty(Id))
{
var model = db.Base_Risk_level_type.FirstOrDefault(x => x.Id == Id);
ddlInType.SelectedValue = model.InType;
txtConText.Text = model.ConText;
}
}
}
protected void btnSave_Click(object sender, EventArgs e) {
var model = new Model.Base_Risk_level_type()
{
InType = ddlInType.SelectedValue,
ConText = txtConText.Text,
Type = "0",
CreateTime = DateTime.Now
};
if (!string.IsNullOrEmpty(Id))
{
model.Id = Id;
BaseRiskleveltypeService.Update(model);
}
else {
model.Id = Guid.NewGuid().ToString();
BaseRiskleveltypeService.Insert(model);
}
ShowNotify("编辑完成!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
}
}