危险源管理模块接入真实数据库:新增危大/超危工程、风险控制清单、安全验收、安全巡检、临时用电管理(含前端页面、BLL/API服务、WebAPI控制器、Model项、SQL脚本与接口文档)
排除 CreateModel.bat(含明文sa密码与本地服务器名,未入库)
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.HazardousMG
|
||||
{
|
||||
/// <summary>
|
||||
/// 编辑专项施工方案页面
|
||||
/// </summary>
|
||||
public partial class SpecialPlanEdit : PageBase
|
||||
{
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
private string PlanId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["PlanId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["PlanId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
this.PlanId = Request.Params["PlanId"];
|
||||
if (!string.IsNullOrEmpty(this.PlanId))
|
||||
{
|
||||
////编辑:回填数据
|
||||
Model.HSSE_SpecialPlan info = BLL.SpecialPlanService.GetById(this.PlanId);
|
||||
if (info != null)
|
||||
{
|
||||
this.txtHazardProjectName.Text = info.HazardProjectName;
|
||||
this.txtPlanName.Text = info.PlanName;
|
||||
this.txtCompileMan.Text = info.CompileMan;
|
||||
if (info.CompileDate.HasValue)
|
||||
{
|
||||
this.dpCompileDate.SelectedDate = info.CompileDate.Value;
|
||||
}
|
||||
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.PlanId))
|
||||
{
|
||||
this.PlanId = Guid.NewGuid().ToString();
|
||||
}
|
||||
////校验附件是否已上传
|
||||
Model.AttachFile attach = BLL.Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.PlanId);
|
||||
if (attach == null || string.IsNullOrEmpty(attach.AttachUrl))
|
||||
{
|
||||
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.HSSE_SpecialPlan info = new Model.HSSE_SpecialPlan
|
||||
{
|
||||
PlanId = this.PlanId,
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
HazardProjectName = this.txtHazardProjectName.Text.Trim(),
|
||||
PlanName = this.txtPlanName.Text.Trim(),
|
||||
CompileMan = this.txtCompileMan.Text.Trim(),
|
||||
CompileDate = this.dpCompileDate.SelectedDate,
|
||||
Remark = this.txtRemark.Text.Trim()
|
||||
};
|
||||
////存在则更新,不存在则新增(服务层已处理)
|
||||
BLL.SpecialPlanService.Update(info);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传附件
|
||||
/// </summary>
|
||||
protected void btnAttach_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.PlanId))
|
||||
{
|
||||
this.PlanId = Guid.NewGuid().ToString();
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/SpecialPlan&menuId={1}", this.PlanId, BLL.Const.SpecialSchemeMenuId)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user