339 lines
14 KiB
C#
339 lines
14 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public static class ConstructionRiskListService
|
|
{
|
|
|
|
|
|
/// <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,
|
|
IsLarge = constructionRisk.IsLarge,
|
|
IsSuperLarge = constructionRisk.IsSuperLarge,
|
|
SubUnitDutyPerson = constructionRisk.SubUnitDutyPerson,
|
|
MainUnitDutyPerson = constructionRisk.MainUnitDutyPerson,
|
|
MainUnitCheckPerson = constructionRisk.MainUnitCheckPerson,
|
|
};
|
|
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;
|
|
newHazardList.IsLarge = hazardList.IsLarge;
|
|
newHazardList.IsSuperLarge = hazardList.IsSuperLarge;
|
|
newHazardList.SubUnitDutyPerson = hazardList.SubUnitDutyPerson;
|
|
newHazardList.MainUnitDutyPerson = hazardList.MainUnitDutyPerson;
|
|
newHazardList.MainUnitCheckPerson = hazardList.MainUnitCheckPerson;
|
|
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[] RefLicenseList()
|
|
{
|
|
ListItem[] lis = new ListItem[10];
|
|
lis[0] = new ListItem("不涉及", "不涉及");
|
|
lis[1] = new ListItem("动火作业", "动火作业");
|
|
lis[2] = new ListItem("高处作业", "高处作业");
|
|
lis[3] = new ListItem("受限空间作业", "受限空间作业");
|
|
lis[4] = new ListItem("射线作业", "射线作业");
|
|
lis[5] = new ListItem("断路(占道)作业", "断路(占道)作业");
|
|
lis[6] = new ListItem("夜间施工作业", "夜间施工作业");
|
|
lis[7] = new ListItem("吊装作业", "吊装作业");
|
|
lis[8] = new ListItem("动土作业", "动土作业");
|
|
lis[9] = new ListItem("试压作业", "试压作业");
|
|
return lis;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取作业风险下拉项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] LicenseDesList()
|
|
{
|
|
ListItem[] lis = new ListItem[20];
|
|
lis[0] = new ListItem("物体打击", "物体打击");
|
|
lis[1] = new ListItem("车辆伤害", "车辆伤害");
|
|
lis[2] = new ListItem("机械伤害", "机械伤害");
|
|
lis[3] = new ListItem("起重伤害", "起重伤害");
|
|
lis[4] = new ListItem("触电", "触电");
|
|
lis[5] = new ListItem("淹溺", "淹溺");
|
|
lis[6] = new ListItem("灼烫", "灼烫");
|
|
lis[7] = new ListItem("火灾", "火灾");
|
|
lis[8] = new ListItem("高处坠落", "高处坠落");
|
|
lis[9] = new ListItem("坍塌", "坍塌");
|
|
lis[10] = new ListItem("冒顶片帮", "冒顶片帮");
|
|
lis[11] = new ListItem("透水", "透水");
|
|
lis[12] = new ListItem("放炮", "放炮");
|
|
lis[13] = new ListItem("火药爆炸", "火药爆炸");
|
|
lis[14] = new ListItem("瓦斯爆炸", "瓦斯爆炸");
|
|
lis[15] = new ListItem("锅炉爆炸", "锅炉爆炸");
|
|
lis[16] = new ListItem("容器爆炸", "容器爆炸");
|
|
lis[17] = new ListItem("其他爆炸", "其他爆炸");
|
|
lis[18] = new ListItem("中毒和窒息", "中毒和窒息");
|
|
lis[19] = new ListItem("其他伤害", "其他伤害");
|
|
return lis;
|
|
}
|
|
|
|
/// <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>
|
|
/// <returns></returns>
|
|
public static ListItem[] RiskLevelList3()
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = 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 "";
|
|
}
|
|
}
|
|
}
|