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 定义变量 /// /// 项目主键 /// public string ControlId { get { return (string)ViewState["ControlId"]; } set { ViewState["ControlId"] = value; } } public string ConstructionRiskId { get { return (string)ViewState["ConstructionRiskId"]; } set { ViewState["ConstructionRiskId"] = value; } } #endregion #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string ControlId = Request["ControlId"]; if (!string.IsNullOrEmpty(ControlId)) { this.ControlId = ControlId; } var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x=>x.ControlId == this.ControlId); if (constructionRiskControl != null) { this.ConstructionRiskId = constructionRiskControl.ConstructionRiskId; if (!string.IsNullOrEmpty(constructionRiskControl.CheckResult)) { rbCheckResult.SelectedValue = constructionRiskControl.CheckResult; } if (!string.IsNullOrEmpty(constructionRiskControl.Rectification)) { rbRectification.SelectedValue = constructionRiskControl.Rectification; } } if (this.rbCheckResult.SelectedValue == "符合") { this.rbRectification.Hidden = true; } else { this.rbRectification.Hidden = false; } } } #endregion #region 保存按钮 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { this.SaveData(BLL.Const.BtnSave); } #endregion /// /// 保存数据 /// /// private void SaveData(string type) { Model.HSSE_ConstructionRiskControl newconstructionRisk = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x => x.ControlId == this.ControlId); string str = string.Empty; if (newconstructionRisk != null) { newconstructionRisk.CheckMan = this.CurrUser.PersonId; newconstructionRisk.CheckResult = rbCheckResult.SelectedValue; if (this.rbCheckResult.SelectedValue == "不符合") { newconstructionRisk.Rectification = rbRectification.SelectedValue; str= rbRectification.SelectedValue; } } Funs.DB.SubmitChanges(); 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; } } } }