222 lines
12 KiB
C#
222 lines
12 KiB
C#
using BLL;
|
|
using FineUIPro.Web.Comprehensive;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.ThreeYearAction.FireGasSafety
|
|
{
|
|
public partial class ElectricityAndGasSafetyInspectionEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string Id
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["Id"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["Id"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 项目主键
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.InitDropDownList();
|
|
this.Id = Request.Params["FileId"];
|
|
if (!string.IsNullOrEmpty(this.Id))
|
|
{
|
|
Model.FireGasSafety_ElectricityAndGasSafetyInspection model = BLL.ElectricityandgassafetyinspectionService.GetById(this.Id);
|
|
if (model != null)
|
|
{
|
|
this.ProjectId = model.ProjectId;
|
|
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
|
{
|
|
this.InitDropDownList();
|
|
}
|
|
///读取编号
|
|
this.txtCode.Text = model.Code;
|
|
this.txtName.Text = model.Name;
|
|
this.rblIsRandomlyPullingWires.SelectedValue = model.IsRandomlyPullingWires.HasValue && model.IsRandomlyPullingWires == true ? "true" : "false";
|
|
this.rblIsGasAppliancesPipingNormal.SelectedValue = model.IsGasAppliancesPipingNormal.HasValue && model.IsGasAppliancesPipingNormal == true ? "true" : "false";
|
|
this.rblIsPowerRoomStackingDebris.SelectedValue = model.IsPowerRoomStackingDebris.HasValue && model.IsPowerRoomStackingDebris == true ? "true" : "false";
|
|
this.rblIsHoursPowerDump.SelectedValue = model.IsHoursPowerDump.HasValue && model.IsHoursPowerDump == true ? "true" : "false";
|
|
this.rblIsSmoking.SelectedValue = model.IsSmoking.HasValue && model.IsSmoking == true ? "true" : "false";
|
|
this.rblIsOpenFlameConstruction.SelectedValue = model.IsOpenFlameConstruction.HasValue && model.IsOpenFlameConstruction == true ? "true" : "false";
|
|
this.rblIsViolationOfElectricityGas.SelectedValue = model.IsViolationOfElectricityGas.HasValue && model.IsViolationOfElectricityGas == true ? "true" : "false";
|
|
|
|
this.rblIsEXITStackingDebris.SelectedValue = model.IsEXITStackingDebris.HasValue && model.IsEXITStackingDebris == true ? "true" : "false";
|
|
this.rblIsFireProofDoorClosed.SelectedValue = model.IsFireProofDoorClosed.HasValue && model.IsFireProofDoorClosed == true ? "true" : "false";
|
|
this.rblIsEmergencyLampNormal.SelectedValue = model.IsEmergencyLampNormal.HasValue && model.IsEmergencyLampNormal == true ? "true" : "false";
|
|
this.rblIsEvacuationSignsNormal.SelectedValue = model.IsEvacuationSignsNormal.HasValue && model.IsEvacuationSignsNormal == true ? "true" : "false";
|
|
this.rblIsFireExtinguisherNormal.SelectedValue = model.IsFireExtinguisherNormal.HasValue && model.IsFireExtinguisherNormal == true ? "true" : "false";
|
|
this.rblIsFireExtinguisherMisapply.SelectedValue = model.IsFireExtinguisherMisapply.HasValue && model.IsFireExtinguisherMisapply == true ? "true" : "false";
|
|
this.rblIsMonitorNormal.SelectedValue = model.IsMonitorNormal.HasValue && model.IsMonitorNormal == true ? "true" : "false";
|
|
this.rblIsFireproofCurtainStackingDebris.SelectedValue = model.IsFireproofCurtainStackingDebris.HasValue && model.IsFireproofCurtainStackingDebris == true ? "true" : "false";
|
|
this.rblIsPersonnelOnDuty.SelectedValue = model.IsPersonnelOnDuty.HasValue && model.IsPersonnelOnDuty == true ? "true" : "false";
|
|
this.rblIsFireProtectionSignsNormal.SelectedValue = model.IsFireProtectionSignsNormal.HasValue && model.IsFireProtectionSignsNormal == true ? "true" : "false";
|
|
|
|
if (!string.IsNullOrEmpty(model.CompileMan))
|
|
{
|
|
this.drpCompileMan.SelectedValue = model.CompileMan;
|
|
}
|
|
if (!string.IsNullOrEmpty(model.Administrator))
|
|
{
|
|
this.drpAdministrator.SelectedValue = model.Administrator;
|
|
}
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", model.CompileDate);
|
|
this.txtContent.Text = model.Content;
|
|
|
|
if (!string.IsNullOrEmpty(model.Administrator))
|
|
{
|
|
this.drpAdministrator.SelectedValue = model.Administrator;
|
|
}
|
|
this.txtFindFireHazards.Text = model.FindFireHazards;
|
|
this.txtHandlingSituation.Text = model.HandlingSituation;
|
|
this.txtAdministratorOpinion.Text = model.AdministratorOpinion;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
|
|
////自动生成编码
|
|
this.txtCode.Text = SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "FireGasSafety_ElectricityAndGasSafetyInspection", "Code", CurrUser.LoginProjectId);
|
|
this.txtName.Text = this.SimpleForm1.Title;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化下拉框
|
|
/// </summary>
|
|
private void InitDropDownList()
|
|
{
|
|
BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.ProjectId, false);
|
|
BLL.UserService.InitUserDropDownList(this.drpAdministrator, this.ProjectId, false);
|
|
}
|
|
#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.GetHideRefreshReference());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存数据
|
|
/// </summary>
|
|
/// <param name="type"></param>
|
|
private void SaveData(string type)
|
|
{
|
|
Model.FireGasSafety_ElectricityAndGasSafetyInspection model = new Model.FireGasSafety_ElectricityAndGasSafetyInspection
|
|
{
|
|
ProjectId = this.ProjectId,
|
|
Code = this.txtCode.Text.Trim(),
|
|
Name = this.txtName.Text.Trim(),
|
|
Content = this.txtContent.Text.Trim(),
|
|
FindFireHazards = this.txtFindFireHazards.Text.Trim(),
|
|
HandlingSituation = this.txtHandlingSituation.Text.Trim(),
|
|
AdministratorOpinion = this.txtAdministratorOpinion.Text.Trim(),
|
|
IsRandomlyPullingWires = this.rblIsRandomlyPullingWires.SelectedValue == "true" ? true : false,
|
|
IsGasAppliancesPipingNormal = this.rblIsGasAppliancesPipingNormal.SelectedValue == "true" ? true : false,
|
|
IsPowerRoomStackingDebris = this.rblIsPowerRoomStackingDebris.SelectedValue == "true" ? true : false,
|
|
IsHoursPowerDump = this.rblIsHoursPowerDump.SelectedValue == "true" ? true : false,
|
|
IsSmoking = this.rblIsSmoking.SelectedValue == "true" ? true : false,
|
|
IsOpenFlameConstruction = this.rblIsOpenFlameConstruction.SelectedValue == "true" ? true : false,
|
|
IsViolationOfElectricityGas = this.rblIsViolationOfElectricityGas.SelectedValue == "true" ? true : false,
|
|
|
|
IsEXITStackingDebris = this.rblIsEXITStackingDebris.SelectedValue == "true" ? true : false,
|
|
IsFireProofDoorClosed = this.rblIsFireProofDoorClosed.SelectedValue == "true" ? true : false,
|
|
IsEmergencyLampNormal = this.rblIsEmergencyLampNormal.SelectedValue == "true" ? true : false,
|
|
IsEvacuationSignsNormal = this.rblIsEvacuationSignsNormal.SelectedValue == "true" ? true : false,
|
|
IsFireExtinguisherNormal = this.rblIsFireExtinguisherNormal.SelectedValue == "true" ? true : false,
|
|
IsFireExtinguisherMisapply = this.rblIsFireExtinguisherMisapply.SelectedValue == "true" ? true : false,
|
|
IsMonitorNormal = this.rblIsMonitorNormal.SelectedValue == "true" ? true : false,
|
|
IsFireproofCurtainStackingDebris = this.rblIsFireproofCurtainStackingDebris.SelectedValue == "true" ? true : false,
|
|
IsPersonnelOnDuty = this.rblIsPersonnelOnDuty.SelectedValue == "true" ? true : false,
|
|
IsFireProtectionSignsNormal = this.rblIsFireProtectionSignsNormal.SelectedValue == "true" ? true : false,
|
|
};
|
|
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
model.CompileMan = this.drpCompileMan.SelectedValue;
|
|
}
|
|
if (this.drpAdministrator.SelectedValue != BLL.Const._Null)
|
|
{
|
|
model.Administrator = this.drpAdministrator.SelectedValue;
|
|
}
|
|
model.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
|
|
|
|
////单据状态
|
|
if (!string.IsNullOrEmpty(this.Id))
|
|
{
|
|
model.Id = this.Id;
|
|
BLL.ElectricityandgassafetyinspectionService.Update(model);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, model.Code, model.Id, BLL.Const.ElectricityAndGasSafetyInspectionMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
this.Id = SQLHelper.GetNewID(typeof(Model.FireGasSafety_ElectricityAndGasSafetyInspection));
|
|
model.Id = this.Id;
|
|
BLL.ElectricityandgassafetyinspectionService.Add(model);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, model.Code, model.Id, BLL.Const.ElectricityAndGasSafetyInspectionMenuId, BLL.Const.BtnAdd);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 上传附件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.Id))
|
|
{
|
|
SaveData(BLL.Const.BtnSave);
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ElectricityAndGasSafetyInspectionAttachUrl&menuId={1}", Id, BLL.Const.ElectricityAndGasSafetyInspectionMenuId)));
|
|
}
|
|
#endregion
|
|
}
|
|
} |