270 lines
11 KiB
C#
270 lines
11 KiB
C#
using Org.BouncyCastle.Bcpg.Sig;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public static class ConstructionRiskListService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 要求主键获取危险清单信息
|
|
/// </summary>
|
|
/// <param name="hazardListCode">主键</param>
|
|
/// <returns></returns>
|
|
public static Model.HSSE_ConstructionRisk GetConstructionRisk(string constructionRiskId)
|
|
{
|
|
return Funs.DB.HSSE_ConstructionRisk.FirstOrDefault(e => e.ConstructionRiskId == constructionRiskId);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="hazardList"></param>
|
|
public static void AddConstructionRisk(Model.HSSE_ConstructionRisk constructionRisk)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HSSE_ConstructionRisk newconstructionRisk = new Model.HSSE_ConstructionRisk
|
|
{
|
|
ProjectId = constructionRisk.ProjectId,
|
|
|
|
ConstructionRiskId = constructionRisk.ConstructionRiskId,
|
|
DateA = constructionRisk.DateA,
|
|
DateZ = constructionRisk.DateZ,
|
|
DateWeek = constructionRisk.DateWeek,
|
|
ConstructionContent = constructionRisk.ConstructionContent,
|
|
ConstructionContentId = constructionRisk.ConstructionContentId,
|
|
States = constructionRisk.States,
|
|
RefLicense = constructionRisk.RefLicense,
|
|
LicenseDes = constructionRisk.LicenseDes,
|
|
WorkAreaId = constructionRisk.WorkAreaId,
|
|
UnitId = constructionRisk.UnitId,
|
|
RiskLevel = constructionRisk.RiskLevel,
|
|
Coordinate = constructionRisk.Coordinate,
|
|
};
|
|
Funs.DB.HSSE_ConstructionRisk.InsertOnSubmit(newconstructionRisk);
|
|
Funs.DB.SubmitChanges();
|
|
|
|
}
|
|
|
|
public static void AddConstructionRiskControl(Model.HSSE_ConstructionRiskControl constructionRiskControl)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HSSE_ConstructionRiskControl newconstructionRisk = new Model.HSSE_ConstructionRiskControl
|
|
{
|
|
|
|
ControlId = constructionRiskControl.ControlId,
|
|
Measures = constructionRiskControl.Measures,
|
|
CheckMan = constructionRiskControl.CheckMan,
|
|
CheckResult = constructionRiskControl.CheckResult,
|
|
Rectification = constructionRiskControl.Rectification,
|
|
ShowIndex = constructionRiskControl.ShowIndex,
|
|
ConstructionRiskId = constructionRiskControl.ConstructionRiskId
|
|
};
|
|
Funs.DB.HSSE_ConstructionRiskControl.InsertOnSubmit(newconstructionRisk);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
public static void UpdateConstructionRiskControl(Model.HSSE_ConstructionRiskControl constructionRiskControl)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HSSE_ConstructionRiskControl newconstructionRisk = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x => x.ControlId == constructionRiskControl.ControlId);
|
|
|
|
if (newconstructionRisk != null)
|
|
{
|
|
newconstructionRisk.ControlId = constructionRiskControl.ControlId;
|
|
newconstructionRisk.Measures = constructionRiskControl.Measures;
|
|
newconstructionRisk.CheckMan = constructionRiskControl.CheckMan;
|
|
newconstructionRisk.CheckResult = constructionRiskControl.CheckResult;
|
|
newconstructionRisk.Rectification = constructionRiskControl.Rectification;
|
|
newconstructionRisk.ShowIndex = constructionRiskControl.ShowIndex;
|
|
newconstructionRisk.ConstructionRiskId = constructionRiskControl.ConstructionRiskId;
|
|
}
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
public static void AddConstructionRiskControl(List<Model.HSSE_ConstructionRiskControl> constructionRisk, string constructionRiskId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
int i = 1;
|
|
|
|
var cons = Funs.DB.HSSE_ConstructionRiskControl.Where(x => x.ConstructionRiskId == constructionRiskId);
|
|
if (cons.Count() > 0)
|
|
{
|
|
Funs.DB.HSSE_ConstructionRiskControl.DeleteAllOnSubmit(cons);
|
|
}
|
|
foreach (var item in constructionRisk)
|
|
{
|
|
Model.HSSE_ConstructionRiskControl newconstructionRisk = new Model.HSSE_ConstructionRiskControl
|
|
{
|
|
ControlId = item.ControlId,
|
|
ConstructionRiskId = constructionRiskId,
|
|
Measures = item.Measures,
|
|
CheckResult = item.CheckResult,
|
|
CheckMan = item.CheckMan,
|
|
Rectification = item.Rectification,
|
|
ShowIndex = i++,
|
|
};
|
|
Funs.DB.HSSE_ConstructionRiskControl.InsertOnSubmit(newconstructionRisk);
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="hazardList"></param>
|
|
public static void UpdateConstructionRisk(Model.HSSE_ConstructionRisk hazardList)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HSSE_ConstructionRisk newHazardList = db.HSSE_ConstructionRisk.FirstOrDefault(e => e.ConstructionRiskId == hazardList.ConstructionRiskId);
|
|
if (newHazardList != null)
|
|
{
|
|
newHazardList.ProjectId = hazardList.ProjectId;
|
|
newHazardList.DateA = hazardList.DateA;
|
|
newHazardList.DateZ = hazardList.DateZ;
|
|
newHazardList.DateWeek = hazardList.DateWeek;
|
|
newHazardList.ConstructionContent = hazardList.ConstructionContent;
|
|
newHazardList.ConstructionContentId = hazardList.ConstructionContentId;
|
|
newHazardList.States = hazardList.States;
|
|
newHazardList.RefLicense = hazardList.RefLicense;
|
|
newHazardList.LicenseDes = hazardList.LicenseDes;
|
|
newHazardList.WorkAreaId = hazardList.WorkAreaId;
|
|
newHazardList.UnitId = hazardList.UnitId;
|
|
newHazardList.RiskLevel = hazardList.RiskLevel;
|
|
newHazardList.Coordinate = hazardList.Coordinate;
|
|
db.SubmitChanges();
|
|
}
|
|
else
|
|
{
|
|
AddConstructionRisk(hazardList);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="constructionRiskId"> </param>
|
|
public static void DeleteConstructionRisk(string constructionRiskId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HSSE_ConstructionRisk hazardList = db.HSSE_ConstructionRisk.FirstOrDefault(e => e.ConstructionRiskId == constructionRiskId);
|
|
if (hazardList != null)
|
|
{
|
|
|
|
var constructionRiskControls = db.HSSE_ConstructionRiskControl.Where(e => e.ConstructionRiskId == constructionRiskId);
|
|
if (constructionRiskControls.Count() > 0)
|
|
{
|
|
db.HSSE_ConstructionRiskControl.DeleteAllOnSubmit(constructionRiskControls);
|
|
}
|
|
db.HSSE_ConstructionRisk.DeleteOnSubmit(hazardList);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取风险等级下拉项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] RiskLevelList()
|
|
{
|
|
ListItem[] lis = new ListItem[4];
|
|
lis[0] = new ListItem("低风险", "低风险");
|
|
lis[1] = new ListItem("一般风险", "一般风险");
|
|
lis[2] = new ListItem("较大风险", "较大风险");
|
|
lis[3] = new ListItem("重大风险", "重大风险");
|
|
return lis;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取风险等级下拉项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] RiskLevelList2()
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("较大风险", "较大风险");
|
|
lis[1] = new ListItem("重大风险", "重大风险");
|
|
return lis;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据状态选择下一步办理类型
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetDHandleTypeByState(string state)
|
|
{
|
|
if (state == Const.ConstructionRisk_Compile || state == Const.ConstructionRisk_ReCompile) //无是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("总包施工经理审核", Const.ConstructionRisk_Audit1);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ConstructionRisk_Audit1)//有是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("总包安全经理审核", Const.ConstructionRisk_Audit2);//是 加载
|
|
lis[1] = new ListItem("重新编制", Const.ConstructionRisk_ReCompile);//否加载
|
|
return lis;
|
|
}
|
|
else if (state == Const.ConstructionRisk_Audit2)//有是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("审核完成", Const.ConstructionRisk_Audit3);//是 加载
|
|
lis[1] = new ListItem("重新编制", Const.ConstructionRisk_ReCompile);//否加载
|
|
return lis;
|
|
}
|
|
else
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.ConstructionRisk_ReCompile)
|
|
{
|
|
return "重新编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ConstructionRisk_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ConstructionRisk_Audit1)
|
|
{
|
|
return "总包施工经理审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ConstructionRisk_Audit2)
|
|
{
|
|
return "总包安全经理审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ConstructionRisk_Audit3)
|
|
{
|
|
return "实施中";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ConstructionRisk_Complete)
|
|
{
|
|
return "完成";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
}
|
|
}
|