危险源管理模块接入真实数据库:新增危大/超危工程、风险控制清单、安全验收、安全巡检、临时用电管理(含前端页面、BLL/API服务、WebAPI控制器、Model项、SQL脚本与接口文档)
排除 CreateModel.bat(含明文sa密码与本地服务器名,未入库)
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.HazardousMG
|
||||
{
|
||||
/// <summary>
|
||||
/// 编辑危大、超危工程页面
|
||||
/// </summary>
|
||||
public partial class HazardProjectEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string HazardProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["HazardProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["HazardProjectId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.HazardProjectId = Request.Params["HazardProjectId"];
|
||||
if (!string.IsNullOrEmpty(this.HazardProjectId))
|
||||
{
|
||||
////编辑:回填数据
|
||||
Model.HSSE_HazardProject info = BLL.HazardProjectService.GetById(this.HazardProjectId);
|
||||
if (info != null)
|
||||
{
|
||||
this.txtProjectName.Text = info.ProjectName;
|
||||
this.txtWorkContent.Text = info.WorkContent;
|
||||
this.ddlRiskLevel.SelectedValue = info.RiskLevel;
|
||||
if (info.StartDate.HasValue)
|
||||
{
|
||||
this.dpStartDate.SelectedDate = info.StartDate.Value;
|
||||
}
|
||||
if (info.EndDate.HasValue)
|
||||
{
|
||||
this.dpEndDate.SelectedDate = info.EndDate.Value;
|
||||
}
|
||||
this.txtManagerMan.Text = info.ManagerMan;
|
||||
this.txtRemark.Text = info.Remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存按钮事件
|
||||
/// </summary>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
Alert.ShowInTop("请先选择项目!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.HazardProjectId))
|
||||
{
|
||||
////编辑:更新原记录(仅更新表单字段,保留编号等内部字段)
|
||||
Model.HSSE_HazardProject info = BLL.HazardProjectService.GetById(this.HazardProjectId);
|
||||
if (info != null)
|
||||
{
|
||||
info.ProjectName = this.txtProjectName.Text.Trim();
|
||||
info.WorkContent = this.txtWorkContent.Text.Trim();
|
||||
info.RiskLevel = this.ddlRiskLevel.SelectedValue;
|
||||
info.StartDate = this.dpStartDate.SelectedDate;
|
||||
info.EndDate = this.dpEndDate.SelectedDate;
|
||||
info.ManagerMan = this.txtManagerMan.Text.Trim();
|
||||
info.Remark = this.txtRemark.Text.Trim();
|
||||
BLL.HazardProjectService.Update(info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
////新增:插入记录,编号自动生成
|
||||
Model.HSSE_HazardProject info = new Model.HSSE_HazardProject
|
||||
{
|
||||
HazardProjectId = Guid.NewGuid().ToString(),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
ProjectCode = BLL.HazardProjectService.GetNewCode(),
|
||||
ProjectName = this.txtProjectName.Text.Trim(),
|
||||
WorkContent = this.txtWorkContent.Text.Trim(),
|
||||
RiskLevel = this.ddlRiskLevel.SelectedValue,
|
||||
StartDate = this.dpStartDate.SelectedDate,
|
||||
EndDate = this.dpEndDate.SelectedDate,
|
||||
ManagerMan = this.txtManagerMan.Text.Trim(),
|
||||
Remark = this.txtRemark.Text.Trim()
|
||||
};
|
||||
BLL.HazardProjectService.Add(info);
|
||||
}
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user