193 lines
7.9 KiB
C#
193 lines
7.9 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.HSSE.Manager
|
|
{
|
|
public partial class MonthReportCEdit8 : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 月报告查主键
|
|
/// </summary>
|
|
public string MonthReportId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["MonthReportId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["MonthReportId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目主键
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
#region 定义集合
|
|
/// <summary>
|
|
/// HSE合规义务识别与评价表
|
|
/// </summary>
|
|
private static List<Model.Manager_Month_ComplianceObligationsC> complianceObligationsCs = new List<Model.Manager_Month_ComplianceObligationsC>();
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 加载
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
complianceObligationsCs.Clear();
|
|
this.MonthReportId = Request.Params["monthReportId"];
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
DateTime months = Convert.ToDateTime(Request.Params["months"]);
|
|
Model.Manager_MonthReportC monthReport = BLL.MonthReportCService.GetMonthReportByMonths(months, this.CurrUser.LoginProjectId);
|
|
|
|
if (monthReport != null)
|
|
{
|
|
this.MonthReportId = monthReport.MonthReportId;
|
|
this.ProjectId = monthReport.ProjectId;
|
|
months = Convert.ToDateTime(monthReport.Months);
|
|
|
|
complianceObligationsCs = (from x in Funs.DB.Manager_Month_ComplianceObligationsC where x.MonthReportId == this.MonthReportId select x).ToList();
|
|
if (complianceObligationsCs.Count>0)
|
|
{
|
|
this.Grid1.DataSource = complianceObligationsCs;
|
|
this.Grid1.DataBind();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region HSE合规义务识别与评价
|
|
///// <summary>
|
|
///// 增加HSE合规义务识别与评价
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
jerqueSaveComplianceObligationsCList();
|
|
Model.Manager_Month_ComplianceObligationsC complianceObligationsC = new Model.Manager_Month_ComplianceObligationsC
|
|
{
|
|
ComplianceObligationsId = SQLHelper.GetNewID(typeof(Model.Manager_Month_ComplianceObligationsC))
|
|
};
|
|
complianceObligationsCs.Add(complianceObligationsC);
|
|
this.Grid1.DataSource = complianceObligationsCs;
|
|
this.Grid1.DataBind();
|
|
}
|
|
|
|
///// <summary>
|
|
///// 检查并保存危险源动态识别及控制集合
|
|
///// </summary>
|
|
private void jerqueSaveComplianceObligationsCList()
|
|
{
|
|
complianceObligationsCs.Clear();
|
|
JArray mergedData = Grid1.GetMergedData();
|
|
foreach (JObject mergedRow in mergedData)
|
|
{
|
|
string status = mergedRow.Value<string>("status");
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
int i = mergedRow.Value<int>("index");
|
|
Model.Manager_Month_ComplianceObligationsC hazardSort = new Model.Manager_Month_ComplianceObligationsC
|
|
{
|
|
ComplianceObligationsId = this.Grid1.Rows[i].DataKeys[0].ToString(),
|
|
InformationContent = values.Value<string>("InformationContent").ToString(),
|
|
ResponseMeasures = values.Value<string>("ResponseMeasures").ToString(),
|
|
ImplementationStatus = values.Value<string>("ImplementationStatus").ToString(),
|
|
EvaluationConclusion = values.Value<string>("EvaluationConclusion").ToString()
|
|
};
|
|
complianceObligationsCs.Add(hazardSort);
|
|
}
|
|
}
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
jerqueSaveComplianceObligationsCList();
|
|
string rowID = this.Grid1.DataKeys[e.RowIndex][0].ToString();
|
|
if (e.CommandName == "Delete")
|
|
{
|
|
foreach (var item in complianceObligationsCs)
|
|
{
|
|
if (item.ComplianceObligationsId == rowID)
|
|
{
|
|
complianceObligationsCs.Remove(item);
|
|
break;
|
|
}
|
|
}
|
|
Grid1.DataSource = complianceObligationsCs;
|
|
Grid1.DataBind();
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存按钮
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.Manager_MonthReportC oldMonthReport = BLL.MonthReportCService.GetMonthReportByMonths(Convert.ToDateTime(Request.Params["months"]), this.CurrUser.LoginProjectId);
|
|
if (oldMonthReport != null)
|
|
{
|
|
BLL.MonthReportCService.UpdateMonthReport(oldMonthReport);
|
|
OperateComplianceObligationsCSort(MonthReportId);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, oldMonthReport.MonthReportCode, oldMonthReport.MonthReportId, BLL.Const.ProjectManagerMonthCMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
Model.Manager_MonthReportC monthReport = new Model.Manager_MonthReportC();
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_MonthReportC));
|
|
monthReport.MonthReportId = newKeyID;
|
|
monthReport.ProjectId = this.CurrUser.LoginProjectId;
|
|
this.MonthReportId = newKeyID;
|
|
monthReport.MonthReportCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectManagerMonthCMenuId, this.ProjectId, this.CurrUser.UnitId);
|
|
monthReport.Months = Funs.GetNewDateTime(Request.Params["months"]);
|
|
monthReport.ReportMan = this.CurrUser.UserId;
|
|
monthReport.MonthReportDate = DateTime.Now;
|
|
BLL.MonthReportCService.AddMonthReport(monthReport);
|
|
OperateComplianceObligationsCSort(MonthReportId);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, monthReport.MonthReportCode, monthReport.MonthReportId, BLL.Const.ProjectManagerMonthCMenuId, BLL.Const.BtnAdd);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
|
|
/// <summary>
|
|
/// HSE合规义务识别与评价
|
|
/// </summary>
|
|
/// <param name="monthReportId"></param>
|
|
private void OperateComplianceObligationsCSort(string monthReportId)
|
|
{
|
|
BLL.ComplianceObligationsCService.DeleteComplianceObligationsCByMonthReportId(monthReportId);
|
|
jerqueSaveComplianceObligationsCList();
|
|
foreach (Model.Manager_Month_ComplianceObligationsC coc in complianceObligationsCs)
|
|
{
|
|
coc.MonthReportId = monthReportId;
|
|
BLL.ComplianceObligationsCService.AddComplianceObligationsC(coc);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |