SGGL_JT/SUBQHSE/FineUIPro.Web/ThreeYearAction/FireGasSafety/SafetyOrganizationSave.aspx.cs

74 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using FineUIPro.Web.ProjectData;
using Model;
namespace FineUIPro.Web.ThreeYearAction.FireGasSafety
{
public partial class SafetyOrganizationSave : PageBase
{
private static string superId;
private static string id;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
superId = Request.Params["SuperId"];
id = Request.Params["Id"];
Model.FireGasSafety_SafetyOrganization model = BLL.SafetyorganizationService.GetSafetyOrganizationById(id);
LoadData();
if (model != null)
{
this.txtUnitName.Text = model.UnitName;
}
}
}
private void LoadData()
{
//btnClose.OnClientClick = ActiveWindow.GetHideReference();
}
protected void btnSave_Click(object sender, EventArgs e)
{
Model.FireGasSafety_SafetyOrganization newmodel = new FireGasSafety_SafetyOrganization();
newmodel.ProjectId = superId;
newmodel.UnitName = txtUnitName.Text.Trim();
//newmodel.OrganizationPic = txtUnitName.Text.Trim();
newmodel.CompileMan = this.CurrUser.UserId;
newmodel.CompileDate = DateTime.Now;
if (string.IsNullOrEmpty(id))
{
newmodel.Id = SQLHelper.GetNewID(typeof(Model.FireGasSafety_SafetyOrganization));
BLL.SafetyorganizationService.AddSafetyOrganization(newmodel);
BLL.LogService.AddSys_Log(this.CurrUser, newmodel.Id, newmodel.Id, BLL.Const.SafetyOrganizationMenuId, "新增组织体系!");
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newmodel.Id) + ActiveWindow.GetHidePostBackReference());
}
else
{
newmodel.Id = id;
BLL.SafetyorganizationService.UpdateSafetyOrganization(newmodel);
BLL.LogService.AddSys_Log(this.CurrUser, newmodel.Id, newmodel.Id, BLL.Const.SafetyOrganizationMenuId, "修改组织体系!");
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
Alert.ShowInParent("保存成功!");
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}