154 lines
5.2 KiB
C#
154 lines
5.2 KiB
C#
|
using BLL;
|
|||
|
using Org.BouncyCastle.Crypto;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HSSE.Hazard
|
|||
|
{
|
|||
|
public partial class ConstructionRiskControlCheck : PageBase
|
|||
|
{
|
|||
|
#region 定义变量
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 项目主键
|
|||
|
/// </summary>
|
|||
|
|
|||
|
public string ConstructionRiskCheckId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ConstructionRiskCheckId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ConstructionRiskCheckId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
public string ConstructionRiskId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ConstructionRiskId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ConstructionRiskId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
string ConstructionRiskCheckId = Request["ConstructionRiskCheckId"];
|
|||
|
if (!string.IsNullOrEmpty(ConstructionRiskCheckId))
|
|||
|
{
|
|||
|
this.ConstructionRiskCheckId = ConstructionRiskCheckId;
|
|||
|
}
|
|||
|
this.ConstructionRiskId = Request["ConstructionRiskId"];
|
|||
|
var constructionRiskCheck = Funs.DB.HSSE_ConstructionRiskCheck.FirstOrDefault(x=>x.ConstructionRiskCheckId == this.ConstructionRiskCheckId);
|
|||
|
if (constructionRiskCheck != null)
|
|||
|
{
|
|||
|
this.ConstructionRiskId = constructionRiskCheck.ConstructionRiskId;
|
|||
|
if (constructionRiskCheck.CheckDate != null)
|
|||
|
{
|
|||
|
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", constructionRiskCheck.CheckDate);
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(constructionRiskCheck.CheckResult))
|
|||
|
{
|
|||
|
rbCheckResult.SelectedValue = constructionRiskCheck.CheckResult;
|
|||
|
}
|
|||
|
if (this.rbCheckResult.SelectedValue == "符合")
|
|||
|
{
|
|||
|
this.rbRectification.Hidden = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.rbRectification.Hidden = false;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(constructionRiskCheck.Rectification))
|
|||
|
{
|
|||
|
rbRectification.SelectedValue = constructionRiskCheck.Rectification;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#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);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="type"></param>
|
|||
|
private void SaveData(string type)
|
|||
|
{
|
|||
|
Model.HSSE_ConstructionRiskCheck check = new Model.HSSE_ConstructionRiskCheck();
|
|||
|
check.ConstructionRiskId = this.ConstructionRiskId;
|
|||
|
check.CheckDate = Funs.GetNewDateTimeOrNow(this.txtCheckDate.Text.Trim());
|
|||
|
check.CheckResult = rbCheckResult.SelectedValue;
|
|||
|
check.CheckMan = this.CurrUser.UserId;
|
|||
|
string str = string.Empty;
|
|||
|
if (this.rbCheckResult.SelectedValue == "不符合")
|
|||
|
{
|
|||
|
check.Rectification = rbRectification.SelectedValue;
|
|||
|
str = rbRectification.SelectedValue;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.ConstructionRiskCheckId))
|
|||
|
{
|
|||
|
check.ConstructionRiskCheckId = this.ConstructionRiskCheckId;
|
|||
|
BLL.ConstructionRiskCheckService.UpdateConstructionRiskCheck(check);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
check.ConstructionRiskCheckId = SQLHelper.GetNewID();
|
|||
|
BLL.ConstructionRiskCheckService.AddConstructionRiskCheck(check);
|
|||
|
str += "|" + check.ConstructionRiskCheckId;
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(str) + ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void rdCheckResult_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
protected void rbCheckResult_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.rbCheckResult.SelectedValue == "符合")
|
|||
|
{
|
|||
|
this.rbRectification.Hidden = true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.rbRectification.Hidden = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|