128 lines
3.9 KiB
C#
128 lines
3.9 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HSSE.Hazard
|
|||
|
{
|
|||
|
public partial class ConstructionRiskControlEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义变量
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string ConstructionRiskId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ConstructionRiskId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ConstructionRiskId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 项目主键
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public string ControlId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ControlId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ControlId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
|
|||
|
this.ConstructionRiskId = Request.Params["ConstructionRiskId"];
|
|||
|
this.ControlId = Request.Params["ControlId"];
|
|||
|
|
|||
|
|
|||
|
var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x=>x.ControlId == this.ControlId);
|
|||
|
if (constructionRiskControl != null)
|
|||
|
{
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(constructionRiskControl.Measures))
|
|||
|
{
|
|||
|
txtMeasures.Text = constructionRiskControl.Measures;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 保存按钮
|
|||
|
/// <summary>
|
|||
|
/// 保存按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.SaveData(BLL.Const.BtnSave);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="type"></param>
|
|||
|
private void SaveData(string type)
|
|||
|
{
|
|||
|
Model.HSSE_ConstructionRiskControl newConstructionRiskControl = new Model.HSSE_ConstructionRiskControl
|
|||
|
{
|
|||
|
ConstructionRiskId = this.ConstructionRiskId,
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
newConstructionRiskControl.Measures = this.txtMeasures.Text ;
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(this.ControlId))
|
|||
|
{
|
|||
|
newConstructionRiskControl.ControlId = this.ControlId;
|
|||
|
BLL.ConstructionRiskListService.UpdateConstructionRiskControl(newConstructionRiskControl);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRiskControl.ConstructionRiskId, newConstructionRiskControl.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnModify);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newConstructionRiskControl.ControlId = SQLHelper.GetNewID(typeof(Model.Hazard_EnvironmentalRiskList));
|
|||
|
this.ControlId = newConstructionRiskControl.ControlId;
|
|||
|
BLL.ConstructionRiskListService.AddConstructionRiskControl(newConstructionRiskControl);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRiskControl.ConstructionRiskId, newConstructionRiskControl.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnAdd);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected void rdCheckResult_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|