20210430
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class EmergencyService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取应急预案
|
||||
/// </summary>
|
||||
/// <param name="emergencyId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_Emergency GetEmergencyListById(string emergencyId)
|
||||
{
|
||||
return Funs.DB.Technique_Emergency.FirstOrDefault(e => e.EmergencyId == emergencyId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据整理人获取应急预案
|
||||
/// </summary>
|
||||
/// <param name="compileMan"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_Emergency> GetEmergencyByCompileMan(string compileMan)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_Emergency where x.CompileMan == compileMan select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加应急预案
|
||||
/// </summary>
|
||||
/// <param name="emergencyList"></param>
|
||||
public static void AddEmergencyList(Model.Technique_Emergency emergencyList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Emergency newEmergencyList = new Model.Technique_Emergency
|
||||
{
|
||||
EmergencyId = emergencyList.EmergencyId,
|
||||
EmergencyTypeId = emergencyList.EmergencyTypeId,
|
||||
EmergencyCode = emergencyList.EmergencyCode,
|
||||
EmergencyName = emergencyList.EmergencyName,
|
||||
Summary = emergencyList.Summary,
|
||||
AttachUrl = emergencyList.AttachUrl,
|
||||
Remark = emergencyList.Remark,
|
||||
CompileMan = emergencyList.CompileMan,
|
||||
CompileDate = emergencyList.CompileDate,
|
||||
IsPass = emergencyList.IsPass,
|
||||
UnitId = emergencyList.UnitId,
|
||||
UpState = emergencyList.UpState
|
||||
};
|
||||
|
||||
db.Technique_Emergency.InsertOnSubmit(newEmergencyList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改应急预案
|
||||
/// </summary>
|
||||
/// <param name="emergencyList"></param>
|
||||
public static void UpdateEmergencyList(Model.Technique_Emergency emergencyList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Emergency newEmergencyList = db.Technique_Emergency.FirstOrDefault(e => e.EmergencyId == emergencyList.EmergencyId);
|
||||
if (newEmergencyList != null)
|
||||
{
|
||||
newEmergencyList.EmergencyTypeId = emergencyList.EmergencyTypeId;
|
||||
newEmergencyList.EmergencyCode = emergencyList.EmergencyCode;
|
||||
newEmergencyList.EmergencyName = emergencyList.EmergencyName;
|
||||
newEmergencyList.Summary = emergencyList.Summary;
|
||||
newEmergencyList.AttachUrl = emergencyList.AttachUrl;
|
||||
newEmergencyList.Remark = emergencyList.Remark;
|
||||
newEmergencyList.UpState = emergencyList.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改应急预案 是否采用
|
||||
/// </summary>
|
||||
/// <param name="emergencyList"></param>
|
||||
public static void UpdateEmergencyListIsPass(Model.Technique_Emergency emergencyList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Emergency newEmergencyList = db.Technique_Emergency.FirstOrDefault(e => e.EmergencyId == emergencyList.EmergencyId);
|
||||
if (newEmergencyList != null)
|
||||
{
|
||||
newEmergencyList.AuditMan = emergencyList.AuditMan;
|
||||
newEmergencyList.AuditDate = emergencyList.AuditDate;
|
||||
newEmergencyList.IsPass = emergencyList.IsPass;
|
||||
newEmergencyList.UpState = emergencyList.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///根据主键删除应急预案
|
||||
/// </summary>
|
||||
/// <param name="emergencyId"></param>
|
||||
public static void DeleteEmergencyListById(string emergencyId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Emergency emergencyList = db.Technique_Emergency.FirstOrDefault(e => e.EmergencyId == emergencyId);
|
||||
if (emergencyList != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(emergencyList.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, emergencyList.AttachUrl);
|
||||
}
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(emergencyList.EmergencyId);
|
||||
|
||||
db.Technique_Emergency.DeleteOnSubmit(emergencyList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class EnvironmentalService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 获取环境危险源信息
|
||||
/// </summary>
|
||||
/// <param name="environmentalId">环境危险源Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_Environmental GetEnvironmental(string environmentalId)
|
||||
{
|
||||
return Funs.DB.Technique_Environmental.FirstOrDefault(x => x.EnvironmentalId == environmentalId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加环境危险源
|
||||
/// </summary>
|
||||
/// <param name="environmental"></param>
|
||||
public static void AddEnvironmental(Model.Technique_Environmental environmental)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Environmental newEnvironmental = new Model.Technique_Environmental
|
||||
{
|
||||
EnvironmentalId = environmental.EnvironmentalId,
|
||||
EType = environmental.EType,
|
||||
ActivePoint = environmental.ActivePoint,
|
||||
EnvironmentalFactors = environmental.EnvironmentalFactors,
|
||||
AValue = environmental.AValue,
|
||||
BValue = environmental.BValue,
|
||||
CValue = environmental.CValue,
|
||||
DValue = environmental.DValue,
|
||||
EValue = environmental.EValue,
|
||||
FValue = environmental.FValue,
|
||||
GValue = environmental.GValue,
|
||||
SmallType = environmental.SmallType,
|
||||
IsImportant = environmental.IsImportant,
|
||||
Code = environmental.Code,
|
||||
ControlMeasures = environmental.ControlMeasures,
|
||||
Remark = environmental.Remark,
|
||||
IsCompany = environmental.IsCompany
|
||||
};
|
||||
db.Technique_Environmental.InsertOnSubmit(newEnvironmental);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改环境危险源信息
|
||||
/// </summary>
|
||||
/// <param name="environmentalId">环境危险源主键</param>
|
||||
/// <param name="depCode"></param>
|
||||
/// <param name="depHead"></param>
|
||||
/// <param name="depName"></param>
|
||||
/// <param name="remark"></param>
|
||||
public static void UpdateEnvironmental(Model.Technique_Environmental environmental)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Environmental newEnvironmental = db.Technique_Environmental.FirstOrDefault(e => e.EnvironmentalId == environmental.EnvironmentalId);
|
||||
if (newEnvironmental != null)
|
||||
{
|
||||
newEnvironmental.EType = environmental.EType;
|
||||
newEnvironmental.ActivePoint = environmental.ActivePoint;
|
||||
newEnvironmental.EnvironmentalFactors = environmental.EnvironmentalFactors;
|
||||
newEnvironmental.AValue = environmental.AValue;
|
||||
newEnvironmental.BValue = environmental.BValue;
|
||||
newEnvironmental.CValue = environmental.CValue;
|
||||
newEnvironmental.DValue = environmental.DValue;
|
||||
newEnvironmental.EValue = environmental.EValue;
|
||||
newEnvironmental.FValue = environmental.FValue;
|
||||
newEnvironmental.GValue = environmental.GValue;
|
||||
newEnvironmental.SmallType = environmental.SmallType;
|
||||
newEnvironmental.IsImportant = environmental.IsImportant;
|
||||
newEnvironmental.Code = environmental.Code;
|
||||
newEnvironmental.ControlMeasures = environmental.ControlMeasures;
|
||||
newEnvironmental.Remark = environmental.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除环境危险源
|
||||
/// </summary>
|
||||
/// <param name="environmentalId"></param>
|
||||
public static void DeleteEnvironmental(string environmentalId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Environmental environmental = db.Technique_Environmental.FirstOrDefault(e => e.EnvironmentalId == environmentalId);
|
||||
if (environmental != null)
|
||||
{
|
||||
db.Technique_Environmental.DeleteOnSubmit(environmental);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否存在相同编号
|
||||
/// </summary>
|
||||
/// <param name="environmentalId"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsEnvironmentalCode(string environmentalId, string code,bool isCompany)
|
||||
{
|
||||
var q = Funs.DB.Technique_Environmental.FirstOrDefault(x => (x.EnvironmentalId != environmentalId || (environmentalId == null && x.EnvironmentalId != null)) && x.Code == code && x.IsCompany == isCompany);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 危险源清单
|
||||
/// </summary>
|
||||
public static class HazardListService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取危险源清单
|
||||
/// </summary>
|
||||
/// <param name="hazardId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_HazardList GetHazardListById(string hazardId)
|
||||
{
|
||||
return Funs.DB.Technique_HazardList.FirstOrDefault(e => e.HazardId == hazardId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据整理人获取危险源清单
|
||||
/// </summary>
|
||||
/// <param name="compileMan"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_HazardList> GetHazardListByCompileMan(string compileMan)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_HazardList where x.CompileMan == compileMan select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据类别获取危险源清单集合
|
||||
/// </summary>
|
||||
/// <param name="compileMan"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_HazardList> GetHazardListByHazardListTypeId(string hazardListTypeId)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_HazardList where x.HazardListTypeId == hazardListTypeId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加危险源清单
|
||||
/// </summary>
|
||||
/// <param name="hazardList"></param>
|
||||
public static void AddHazardList(Model.Technique_HazardList hazardList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardList newHazardList = new Model.Technique_HazardList
|
||||
{
|
||||
HazardId = hazardList.HazardId,
|
||||
HazardListTypeId = hazardList.HazardListTypeId,
|
||||
HazardCode = hazardList.HazardCode,
|
||||
HazardItems = hazardList.HazardItems,
|
||||
DefectsType = hazardList.DefectsType,
|
||||
MayLeadAccidents = hazardList.MayLeadAccidents,
|
||||
HelperMethod = hazardList.HelperMethod,
|
||||
HazardJudge_L = hazardList.HazardJudge_L,
|
||||
HazardJudge_E = hazardList.HazardJudge_E,
|
||||
HazardJudge_C = hazardList.HazardJudge_C,
|
||||
HazardJudge_D = hazardList.HazardJudge_D,
|
||||
HazardLevel = hazardList.HazardLevel,
|
||||
ControlMeasures = hazardList.ControlMeasures,
|
||||
CompileMan = hazardList.CompileMan,
|
||||
CompileDate = hazardList.CompileDate,
|
||||
IsPass = hazardList.IsPass,
|
||||
UnitId = hazardList.UnitId,
|
||||
UpState = hazardList.UpState
|
||||
};
|
||||
db.Technique_HazardList.InsertOnSubmit(newHazardList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改危险源清单
|
||||
/// </summary>
|
||||
/// <param name="hazardList"></param>
|
||||
public static void UpdateHazardList(Model.Technique_HazardList hazardList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardList newHazardList = db.Technique_HazardList.FirstOrDefault(e => e.HazardId == hazardList.HazardId);
|
||||
if (newHazardList != null)
|
||||
{
|
||||
newHazardList.HazardListTypeId = hazardList.HazardListTypeId;
|
||||
newHazardList.HazardCode = hazardList.HazardCode;
|
||||
newHazardList.HazardItems = hazardList.HazardItems;
|
||||
newHazardList.DefectsType = hazardList.DefectsType;
|
||||
newHazardList.MayLeadAccidents = hazardList.MayLeadAccidents;
|
||||
newHazardList.HelperMethod = hazardList.HelperMethod;
|
||||
newHazardList.HazardJudge_L = hazardList.HazardJudge_L;
|
||||
newHazardList.HazardJudge_E = hazardList.HazardJudge_E;
|
||||
newHazardList.HazardJudge_C = hazardList.HazardJudge_C;
|
||||
newHazardList.HazardJudge_D = hazardList.HazardJudge_D;
|
||||
newHazardList.HazardLevel = hazardList.HazardLevel;
|
||||
newHazardList.ControlMeasures = hazardList.ControlMeasures;
|
||||
newHazardList.UpState = hazardList.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改危险源清单 是否采用
|
||||
/// </summary>
|
||||
/// <param name="hazardList"></param>
|
||||
public static void UpdateHazardListIsPass(Model.Technique_HazardList hazardList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardList newHazardList = db.Technique_HazardList.FirstOrDefault(e => e.HazardId == hazardList.HazardId);
|
||||
if (newHazardList != null)
|
||||
{
|
||||
newHazardList.AuditMan = hazardList.AuditMan;
|
||||
newHazardList.AuditDate = hazardList.AuditDate;
|
||||
newHazardList.IsPass = hazardList.IsPass;
|
||||
newHazardList.UpState = hazardList.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除危险源清单
|
||||
/// </summary>
|
||||
/// <param name="hazardId"></param>
|
||||
public static void DeleteHazardListById(string hazardId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardList hazardList = db.Technique_HazardList.FirstOrDefault(e => e.HazardId == hazardId);
|
||||
if (hazardList != null)
|
||||
{
|
||||
db.Technique_HazardList.DeleteOnSubmit(hazardList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///判断相同危险源类型下的是否存在相同代码
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeId"></param>
|
||||
/// <param name="hazardId"></param>
|
||||
/// <param name="hazardCode"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistHazardCode(string hazardListTypeId, string hazardId, string hazardCode)
|
||||
{
|
||||
var q = Funs.DB.Technique_HazardList.FirstOrDefault(x => x.IsPass == true && x.HazardListTypeId == hazardListTypeId && x.HazardCode == hazardCode && (x.HazardId != hazardId || (hazardId == null && x.HazardId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 危险源类型
|
||||
/// </summary>
|
||||
public static class HazardListTypeService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取危险源类型
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_HazardListType GetHazardListTypeById(string hazardListTypeId)
|
||||
{
|
||||
return Funs.DB.Technique_HazardListType.FirstOrDefault(e => e.HazardListTypeId == hazardListTypeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上一节点Id获取所有相关危险源类型
|
||||
/// </summary>
|
||||
/// <param name="supItem"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_HazardListType> GetHazardListTypeBySupItem(string supItem)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_HazardListType where x.SupHazardListTypeId == supItem select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加危险源类型
|
||||
/// </summary>
|
||||
/// <param name="hazardListType"></param>
|
||||
public static void AddHazardListType(Model.Technique_HazardListType hazardListType)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardListType newHazardListType = new Model.Technique_HazardListType
|
||||
{
|
||||
HazardListTypeId = hazardListType.HazardListTypeId,
|
||||
HazardListTypeCode = hazardListType.HazardListTypeCode,
|
||||
HazardListTypeName = hazardListType.HazardListTypeName,
|
||||
SupHazardListTypeId = hazardListType.SupHazardListTypeId,
|
||||
IsEndLevel = hazardListType.IsEndLevel,
|
||||
WorkStage = hazardListType.WorkStage,
|
||||
IsCompany = hazardListType.IsCompany
|
||||
};
|
||||
db.Technique_HazardListType.InsertOnSubmit(newHazardListType);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改危险源类别
|
||||
/// </summary>
|
||||
/// <param name="hazardListType"></param>
|
||||
public static void UpdateHazardListType(Model.Technique_HazardListType hazardListType)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardListType newHazardListType = db.Technique_HazardListType.FirstOrDefault(e => e.HazardListTypeId == hazardListType.HazardListTypeId);
|
||||
if (newHazardListType != null)
|
||||
{
|
||||
newHazardListType.HazardListTypeCode = hazardListType.HazardListTypeCode;
|
||||
newHazardListType.HazardListTypeName = hazardListType.HazardListTypeName;
|
||||
newHazardListType.SupHazardListTypeId = hazardListType.SupHazardListTypeId;
|
||||
newHazardListType.IsEndLevel = hazardListType.IsEndLevel;
|
||||
newHazardListType.WorkStage = hazardListType.WorkStage;
|
||||
//newHazardListType.IsCompany = hazardListType.IsCompany;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeId"></param>
|
||||
public static void DeleteHazardListTypeById(string hazardListTypeId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_HazardListType hazardListType = db.Technique_HazardListType.FirstOrDefault(e => e.HazardListTypeId == hazardListTypeId);
|
||||
if (hazardListType != null)
|
||||
{
|
||||
db.Technique_HazardListType.DeleteOnSubmit(hazardListType);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可删除资源节点
|
||||
/// </summary>
|
||||
/// <param name="postName"></param>
|
||||
/// <returns>true-可以,false-不可以</returns>
|
||||
public static bool IsDeleteHazardListType(string hazardListTypeId)
|
||||
{
|
||||
bool isDelete = true;
|
||||
var hazardListType = BLL.HazardListTypeService.GetHazardListTypeById(hazardListTypeId);
|
||||
if (hazardListType != null)
|
||||
{
|
||||
if (hazardListType.IsBuild == true)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
if (hazardListType.IsEndLevel == true)
|
||||
{
|
||||
var detailCout = Funs.DB.Technique_HazardList.FirstOrDefault(x => x.HazardListTypeId == hazardListTypeId);
|
||||
if (detailCout != null)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var supItemSetCount = GetHazardListTypeBySupItem(hazardListTypeId);
|
||||
if (supItemSetCount.Count() > 0)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否末级项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_HSSEStandardListType> GetIsEndLeverList()
|
||||
{
|
||||
Model.Base_HSSEStandardListType t1 = new Model.Base_HSSEStandardListType
|
||||
{
|
||||
TypeId = "true",
|
||||
TypeName = "是"
|
||||
};
|
||||
Model.Base_HSSEStandardListType t2 = new Model.Base_HSSEStandardListType
|
||||
{
|
||||
TypeId = "false",
|
||||
TypeName = "否"
|
||||
};
|
||||
List<Model.Base_HSSEStandardListType> list = new List<Model.Base_HSSEStandardListType>();
|
||||
list.Add(t1);
|
||||
list.Add(t2);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据类型名称获取
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeName"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_HazardListType GetHazardListTypeByHazardListTypeName(string hazardListTypeName)
|
||||
{
|
||||
return Funs.DB.Technique_HazardListType.FirstOrDefault(e => e.HazardListTypeName == hazardListTypeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全隐患明细
|
||||
/// </summary>
|
||||
public static class RectifyItemService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取安全隐患明细
|
||||
/// </summary>
|
||||
/// <param name="rectifyItemId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_RectifyItem GetRectifyItemById(string rectifyItemId)
|
||||
{
|
||||
return Funs.DB.Technique_RectifyItem.FirstOrDefault(e => e.RectifyItemId == rectifyItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据整理人获取安全隐患明细
|
||||
/// </summary>
|
||||
/// <param name="compileMan"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_RectifyItem> GetRectifyItemByCompileMan(string compileMan)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_RectifyItem where x.CompileMan == compileMan select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加安全隐患明细
|
||||
/// </summary>
|
||||
/// <param name="rectifyItem"></param>
|
||||
public static void AddRectifyItem(Model.Technique_RectifyItem rectifyItem)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_RectifyItem newRectifyItem = new Model.Technique_RectifyItem
|
||||
{
|
||||
RectifyItemId = rectifyItem.RectifyItemId,
|
||||
RectifyId = rectifyItem.RectifyId,
|
||||
HazardSourcePoint = rectifyItem.HazardSourcePoint,
|
||||
RiskAnalysis = rectifyItem.RiskAnalysis,
|
||||
RiskPrevention = rectifyItem.RiskPrevention,
|
||||
SimilarRisk = rectifyItem.SimilarRisk,
|
||||
CompileMan = rectifyItem.CompileMan,
|
||||
CompileDate = rectifyItem.CompileDate,
|
||||
IsPass = rectifyItem.IsPass,
|
||||
UnitId = rectifyItem.UnitId,
|
||||
UpState = rectifyItem.UpState
|
||||
};
|
||||
db.Technique_RectifyItem.InsertOnSubmit(newRectifyItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改安全隐患明细
|
||||
/// </summary>
|
||||
/// <param name="rectifyItem"></param>
|
||||
public static void UpdateRectifyItem(Model.Technique_RectifyItem rectifyItem)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_RectifyItem newRectifyItem = db.Technique_RectifyItem.FirstOrDefault(e => e.RectifyItemId == rectifyItem.RectifyItemId);
|
||||
if (newRectifyItem != null)
|
||||
{
|
||||
newRectifyItem.HazardSourcePoint = rectifyItem.HazardSourcePoint;
|
||||
newRectifyItem.RiskAnalysis = rectifyItem.RiskAnalysis;
|
||||
newRectifyItem.RiskPrevention = rectifyItem.RiskPrevention;
|
||||
newRectifyItem.SimilarRisk = rectifyItem.SimilarRisk;
|
||||
newRectifyItem.UpState = rectifyItem.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改安全隐患明细 是否采用
|
||||
/// </summary>
|
||||
/// <param name="rectifyItem"></param>
|
||||
public static void UpdateRectifyItemIsPass(Model.Technique_RectifyItem rectifyItem)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_RectifyItem newRectifyItem = db.Technique_RectifyItem.FirstOrDefault(e => e.RectifyItemId == rectifyItem.RectifyItemId);
|
||||
if (newRectifyItem != null)
|
||||
{
|
||||
newRectifyItem.AuditMan = rectifyItem.AuditMan;
|
||||
newRectifyItem.AuditDate = rectifyItem.AuditDate;
|
||||
newRectifyItem.IsPass = rectifyItem.IsPass;
|
||||
newRectifyItem.UpState = rectifyItem.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除安全隐患明细
|
||||
/// </summary>
|
||||
/// <param name="rectifyItemId"></param>
|
||||
public static void DeleteRectifyItem(string rectifyItemId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_RectifyItem rectifyItem = db.Technique_RectifyItem.FirstOrDefault(e => e.RectifyItemId == rectifyItemId);
|
||||
if (rectifyItem != null)
|
||||
{
|
||||
db.Technique_RectifyItem.DeleteOnSubmit(rectifyItem);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据安全隐患主键删除所有相关明细信息
|
||||
/// </summary>
|
||||
/// <param name="rectifyId"></param>
|
||||
public static void DeleteRectifyItemByRectifyId(string rectifyId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.Technique_RectifyItem where x.RectifyId == rectifyId select x).ToList();
|
||||
if (q != null)
|
||||
{
|
||||
db.Technique_RectifyItem.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全隐患主表
|
||||
/// </summary>
|
||||
public static class RectifyService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取安全隐患
|
||||
/// </summary>
|
||||
/// <param name="rectifyId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_Rectify GetRectifyById(string rectifyId)
|
||||
{
|
||||
return Funs.DB.Technique_Rectify.FirstOrDefault(e => e.RectifyId == rectifyId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上一节点id获取安全隐患
|
||||
/// </summary>
|
||||
/// <param name="supRectifyId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_Rectify> GetRectifyBySupRectifyId(string supRectifyId)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_Rectify where x.SupRectifyId == supRectifyId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加安全隐患
|
||||
/// </summary>
|
||||
/// <param name="rectify"></param>
|
||||
public static void AddRectify(Model.Technique_Rectify rectify)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Rectify newRectify = new Model.Technique_Rectify
|
||||
{
|
||||
RectifyId = rectify.RectifyId,
|
||||
RectifyCode = rectify.RectifyCode,
|
||||
RectifyName = rectify.RectifyName,
|
||||
SupRectifyId = rectify.SupRectifyId,
|
||||
IsEndLever = rectify.IsEndLever
|
||||
};
|
||||
newRectify.UpState = newRectify.UpState;
|
||||
db.Technique_Rectify.InsertOnSubmit(newRectify);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改安全隐患
|
||||
/// </summary>
|
||||
/// <param name="rectify"></param>
|
||||
public static void UpdateRectify(Model.Technique_Rectify rectify)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Rectify newRectify = db.Technique_Rectify.FirstOrDefault(e => e.RectifyId == rectify.RectifyId);
|
||||
if (newRectify != null)
|
||||
{
|
||||
newRectify.RectifyCode = rectify.RectifyCode;
|
||||
newRectify.RectifyName = rectify.RectifyName;
|
||||
newRectify.SupRectifyId = rectify.SupRectifyId;
|
||||
newRectify.IsEndLever = rectify.IsEndLever;
|
||||
newRectify.UpState = newRectify.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除安全隐患
|
||||
/// </summary>
|
||||
/// <param name="rectifyId"></param>
|
||||
public static void DeleteRectify(string rectifyId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_Rectify rectify = db.Technique_Rectify.FirstOrDefault(e => e.RectifyId == rectifyId);
|
||||
if (rectify != null)
|
||||
{
|
||||
db.Technique_Rectify.DeleteOnSubmit(rectify);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可删除资源节点
|
||||
/// </summary>
|
||||
/// <param name="postName"></param>
|
||||
/// <returns>true-可以,false-不可以</returns>
|
||||
public static bool IsDeleteRectify(string rectifyId)
|
||||
{
|
||||
bool isDelete = true;
|
||||
var rectify = BLL.RectifyService.GetRectifyById(rectifyId);
|
||||
if (rectify != null)
|
||||
{
|
||||
if (rectify.IsBuild == true)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
if (rectify.IsEndLever == true)
|
||||
{
|
||||
var detailCout = Funs.DB.Technique_RectifyItem.FirstOrDefault(x => x.RectifyId == rectifyId);
|
||||
if (detailCout != null)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var supItemSetCount = BLL.RectifyService.GetRectifyBySupRectifyId(rectifyId);
|
||||
if (supItemSetCount.Count() > 0)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isDelete;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class SpecialSchemeService
|
||||
{
|
||||
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取专项方案
|
||||
/// </summary>
|
||||
/// <param name="specialSchemeId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_SpecialScheme GetSpecialSchemeListById(string specialSchemeId)
|
||||
{
|
||||
return Funs.DB.Technique_SpecialScheme.FirstOrDefault(e => e.SpecialSchemeId == specialSchemeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据整理人获取专项方案
|
||||
/// </summary>
|
||||
/// <param name="compileMan"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_SpecialScheme> GetSpecialSchemeByCompileMan(string compileMan)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_SpecialScheme where x.CompileMan == compileMan select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加专项方案
|
||||
/// </summary>
|
||||
/// <param name="specialSchemeList"></param>
|
||||
public static void AddSpecialSchemeList(Model.Technique_SpecialScheme specialSchemeList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_SpecialScheme newSpecialSchemeList = new Model.Technique_SpecialScheme
|
||||
{
|
||||
SpecialSchemeId = specialSchemeList.SpecialSchemeId,
|
||||
SpecialSchemeTypeId = specialSchemeList.SpecialSchemeTypeId,
|
||||
SpecialSchemeCode = specialSchemeList.SpecialSchemeCode,
|
||||
SpecialSchemeName = specialSchemeList.SpecialSchemeName,
|
||||
Summary = specialSchemeList.Summary,
|
||||
AttachUrl = specialSchemeList.AttachUrl,
|
||||
CompileMan = specialSchemeList.CompileMan,
|
||||
CompileDate = specialSchemeList.CompileDate,
|
||||
UnitId = specialSchemeList.UnitId
|
||||
};
|
||||
newSpecialSchemeList.CompileMan = specialSchemeList.CompileMan;
|
||||
newSpecialSchemeList.CompileDate = specialSchemeList.CompileDate;
|
||||
newSpecialSchemeList.IsPass = specialSchemeList.IsPass;
|
||||
newSpecialSchemeList.UpState = specialSchemeList.UpState;
|
||||
db.Technique_SpecialScheme.InsertOnSubmit(newSpecialSchemeList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改专项方案
|
||||
/// </summary>
|
||||
/// <param name="specialSchemeList"></param>
|
||||
public static void UpdateSpecialSchemeList(Model.Technique_SpecialScheme specialSchemeList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_SpecialScheme newSpecialSchemeList = db.Technique_SpecialScheme.FirstOrDefault(e => e.SpecialSchemeId == specialSchemeList.SpecialSchemeId);
|
||||
if (newSpecialSchemeList != null)
|
||||
{
|
||||
newSpecialSchemeList.SpecialSchemeTypeId = specialSchemeList.SpecialSchemeTypeId;
|
||||
newSpecialSchemeList.SpecialSchemeCode = specialSchemeList.SpecialSchemeCode;
|
||||
newSpecialSchemeList.SpecialSchemeName = specialSchemeList.SpecialSchemeName;
|
||||
newSpecialSchemeList.Summary = specialSchemeList.Summary;
|
||||
newSpecialSchemeList.AttachUrl = specialSchemeList.AttachUrl;
|
||||
newSpecialSchemeList.CompileMan = specialSchemeList.CompileMan;
|
||||
newSpecialSchemeList.CompileDate = specialSchemeList.CompileDate;
|
||||
newSpecialSchemeList.UnitId = specialSchemeList.UnitId;
|
||||
newSpecialSchemeList.UpState = specialSchemeList.UpState;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改专项方案 是否采用
|
||||
/// </summary>
|
||||
/// <param name="specialSchemeList"></param>
|
||||
public static void UpdateSpecialSchemeListIsPass(Model.Technique_SpecialScheme specialSchemeList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_SpecialScheme newSpecialSchemeList = db.Technique_SpecialScheme.FirstOrDefault(e => e.SpecialSchemeId == specialSchemeList.SpecialSchemeId);
|
||||
if (newSpecialSchemeList != null)
|
||||
{
|
||||
newSpecialSchemeList.AuditMan = specialSchemeList.AuditMan;
|
||||
newSpecialSchemeList.AuditDate = specialSchemeList.AuditDate;
|
||||
newSpecialSchemeList.IsPass = specialSchemeList.IsPass;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///根据主键删除专项方案
|
||||
/// </summary>
|
||||
/// <param name="specialSchemeId"></param>
|
||||
public static void DeleteSpecialSchemeListById(string specialSchemeId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_SpecialScheme specialSchemeList = db.Technique_SpecialScheme.FirstOrDefault(e => e.SpecialSchemeId == specialSchemeId);
|
||||
if (specialSchemeList != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(specialSchemeList.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, specialSchemeList.AttachUrl);
|
||||
}
|
||||
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(specialSchemeList.SpecialSchemeId);
|
||||
|
||||
db.Technique_SpecialScheme.DeleteOnSubmit(specialSchemeList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 外键判断
|
||||
/// </summary>
|
||||
/// <param name="SpecialSchemeTypeId"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDelteBySpecialSchemeTypeId(string SpecialSchemeTypeId)
|
||||
{
|
||||
List<Model.Technique_SpecialScheme> type = (from x in Funs.DB.Technique_SpecialScheme where x.SpecialSchemeTypeId == SpecialSchemeTypeId select x).ToList();
|
||||
if (type.Count() > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查项明细
|
||||
/// </summary>
|
||||
public static class Technique_CheckItemDetailService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取检查项明细
|
||||
/// </summary>
|
||||
/// <param name="checkItemDetailId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_CheckItemDetail GetCheckItemDetailById(string checkItemDetailId)
|
||||
{
|
||||
return Funs.DB.Technique_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetailId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加检查项明细
|
||||
/// </summary>
|
||||
/// <param name="checkItemDetail"></param>
|
||||
public static void AddCheckItemDetail(Model.Technique_CheckItemDetail checkItemDetail)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemDetail newCheckItemDetail = new Model.Technique_CheckItemDetail
|
||||
{
|
||||
CheckItemDetailId = checkItemDetail.CheckItemDetailId,
|
||||
CheckItemSetId = checkItemDetail.CheckItemSetId,
|
||||
CheckContent = checkItemDetail.CheckContent,
|
||||
SortIndex = checkItemDetail.SortIndex,
|
||||
IsBuiltIn = checkItemDetail.IsBuiltIn
|
||||
};
|
||||
db.Technique_CheckItemDetail.InsertOnSubmit(newCheckItemDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改检查项明细
|
||||
/// </summary>
|
||||
/// <param name="checkItemDetail"></param>
|
||||
public static void UpdateCheckItemDetail(Model.Technique_CheckItemDetail checkItemDetail)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemDetail newCheckItemDetail = db.Technique_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetail.CheckItemDetailId);
|
||||
if (newCheckItemDetail != null)
|
||||
{
|
||||
newCheckItemDetail.CheckContent = checkItemDetail.CheckContent;
|
||||
newCheckItemDetail.SortIndex = checkItemDetail.SortIndex;
|
||||
newCheckItemDetail.IsBuiltIn = checkItemDetail.IsBuiltIn;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除检查项明细
|
||||
/// </summary>
|
||||
/// <param name="checkItemDetailId"></param>
|
||||
public static void DeleteCheckItemDetail(string checkItemDetailId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemDetail checkItemDetail = db.Technique_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetailId);
|
||||
if (checkItemDetail != null)
|
||||
{
|
||||
db.Technique_CheckItemDetail.DeleteOnSubmit(checkItemDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据检查项主键删除所有相关明细信息
|
||||
/// </summary>
|
||||
/// <param name="rectifyId"></param>
|
||||
public static void DeleteCheckItemDetailByCheckItemSetId(string checkItemSetId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.Technique_CheckItemDetail where x.CheckItemSetId == checkItemSetId select x).ToList();
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
db.Technique_CheckItemDetail.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一级节点检查类型
|
||||
/// </summary>
|
||||
/// <param name="CheckItem"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertCheckItemType(object CheckItem)
|
||||
{
|
||||
string type = string.Empty;
|
||||
if (CheckItem != null)
|
||||
{
|
||||
var detail = Funs.DB.Technique_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == CheckItem.ToString());
|
||||
if (detail != null)
|
||||
{
|
||||
var item = Funs.DB.Technique_CheckItemSet.FirstOrDefault (x=>x.CheckItemSetId == detail.CheckItemSetId);
|
||||
if (item != null)
|
||||
{
|
||||
if (item.SupCheckItem == "0")
|
||||
{
|
||||
type = item.CheckItemName;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = GetCheckItemNameBySupCheckItem(item.SupCheckItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.CheckItemSetId == CheckItem.ToString());
|
||||
if (item != null)
|
||||
{
|
||||
if (item.SupCheckItem == "0")
|
||||
{
|
||||
type = item.CheckItemName;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = GetCheckItemNameBySupCheckItem(item.SupCheckItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取顶级检查项名称
|
||||
/// </summary>
|
||||
/// <param name="checkItemSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCheckItemNameBySupCheckItem(string supCheckItem)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var checkItemSet = Funs.DB.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == supCheckItem);
|
||||
if (checkItemSet != null)
|
||||
{
|
||||
if (checkItemSet.SupCheckItem == "0")
|
||||
{
|
||||
name = checkItemSet.CheckItemName;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = GetCheckItemNameBySupCheckItem(checkItemSet.SupCheckItem);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查项
|
||||
/// </summary>
|
||||
public static class Technique_CheckItemSetService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取检查项
|
||||
/// </summary>
|
||||
/// <param name="checkItemSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_CheckItemSet GetCheckItemSetById(string checkItemSetId)
|
||||
{
|
||||
return Funs.DB.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == checkItemSetId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据主键获取检查项名称
|
||||
/// </summary>
|
||||
/// <param name="checkItemSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCheckItemSetNameById(string checkItemSetId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var getItem= Funs.DB.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == checkItemSetId);
|
||||
if (getItem != null)
|
||||
{
|
||||
name = getItem.CheckItemName;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据上一节点id获取检查项
|
||||
/// </summary>
|
||||
/// <param name="supCheckItemSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_CheckItemSet> GetCheckItemSetBySupCheckItemSetId(string supCheckItemSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_CheckItemSet where x.SupCheckItem == supCheckItemSetId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据类型上级节点获取检查列表
|
||||
/// </summary>
|
||||
/// <param name="checkType"></param>
|
||||
/// <param name="supCheckItemSetId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Technique_CheckItemSet> GetCheckItemSetListByCheckTypeSupCheckItem(string checkType, string supCheckItemSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Technique_CheckItemSet
|
||||
where x.CheckType == checkType && x.SupCheckItem == supCheckItemSetId
|
||||
orderby x.MapCode
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加检查项
|
||||
/// </summary>
|
||||
/// <param name="checkItemSet"></param>
|
||||
public static void AddCheckItemSet(Model.Technique_CheckItemSet checkItemSet)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemSet newCheckItemSet = new Model.Technique_CheckItemSet
|
||||
{
|
||||
CheckItemSetId = checkItemSet.CheckItemSetId,
|
||||
CheckItemName = checkItemSet.CheckItemName,
|
||||
SupCheckItem = checkItemSet.SupCheckItem,
|
||||
CheckType = checkItemSet.CheckType,
|
||||
MapCode = checkItemSet.MapCode,
|
||||
IsEndLever = checkItemSet.IsEndLever,
|
||||
SortIndex = checkItemSet.SortIndex,
|
||||
IsBuiltIn = checkItemSet.IsBuiltIn
|
||||
};
|
||||
db.Technique_CheckItemSet.InsertOnSubmit(newCheckItemSet);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改检查项
|
||||
/// </summary>
|
||||
/// <param name="checkItemSet"></param>
|
||||
public static void UpdateCheckItemSet(Model.Technique_CheckItemSet checkItemSet)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemSet newCheckItemSet = db.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == checkItemSet.CheckItemSetId);
|
||||
if (newCheckItemSet != null)
|
||||
{
|
||||
newCheckItemSet.CheckItemName = checkItemSet.CheckItemName;
|
||||
newCheckItemSet.SupCheckItem = checkItemSet.SupCheckItem;
|
||||
newCheckItemSet.MapCode = checkItemSet.MapCode;
|
||||
newCheckItemSet.IsEndLever = checkItemSet.IsEndLever;
|
||||
newCheckItemSet.SortIndex = checkItemSet.SortIndex;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除检查项
|
||||
/// </summary>
|
||||
/// <param name="checkItemSetId"></param>
|
||||
public static void DeleteCheckItemSet(string checkItemSetId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_CheckItemSet checkItemSet = db.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == checkItemSetId);
|
||||
if (checkItemSet != null)
|
||||
{
|
||||
db.Technique_CheckItemSet.DeleteOnSubmit(checkItemSet);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否末级
|
||||
/// </summary>
|
||||
/// <param name="checkItemSetId">检查项目主键</param>
|
||||
/// <returns>布尔值</returns>
|
||||
public static bool IsEndLevel(string checkItemSetId)
|
||||
{
|
||||
if (checkItemSetId == "0")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Technique_CheckItemSet checkItemSet = Funs.DB.Technique_CheckItemSet.FirstOrDefault(e => e.CheckItemSetId == checkItemSetId);
|
||||
return Convert.ToBoolean(checkItemSet.IsEndLever);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可删除资源节点
|
||||
/// </summary>
|
||||
/// <param name="postName"></param>
|
||||
/// <returns>true-可以,false-不可以</returns>
|
||||
public static bool IsDeleteCheckItemSet(string checkItemSetId)
|
||||
{
|
||||
bool isDelete = true;
|
||||
var checkItemSet = BLL.Technique_CheckItemSetService.GetCheckItemSetById(checkItemSetId);
|
||||
if (checkItemSet != null)
|
||||
{
|
||||
//if (checkItemSet.IsBuiltIn == true)
|
||||
//{
|
||||
// isDelete = false;
|
||||
//}
|
||||
if (checkItemSet.IsEndLever == true)
|
||||
{
|
||||
var detailCout = Funs.DB.Technique_CheckItemDetail.FirstOrDefault(x => x.CheckItemSetId == checkItemSetId);
|
||||
if (detailCout != null)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var supItemSetCount = BLL.Technique_CheckItemSetService.GetCheckItemSetBySupCheckItemSetId(checkItemSetId);
|
||||
if (supItemSetCount.Count() > 0)
|
||||
{
|
||||
isDelete = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在检查项名称
|
||||
/// </summary>
|
||||
/// <param name="postName"></param>
|
||||
/// <returns>true-存在,false-不存在</returns>
|
||||
public static bool IsExistCheckItemName(string checkItemSetId, string supCheckItem, string checkItemName)
|
||||
{
|
||||
var q = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.SupCheckItem == supCheckItem && x.CheckItemName == checkItemName
|
||||
&& x.CheckItemSetId != checkItemSetId);
|
||||
if (q != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#region 检查项表下拉框
|
||||
/// <summary>
|
||||
/// 检查项表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitCheckItemSetDropDownList(FineUIPro.DropDownList dropName, string checkType, string supCheckItem, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "CheckItemSetId";
|
||||
dropName.DataTextField = "CheckItemName";
|
||||
dropName.DataSource = GetCheckItemSetListByCheckTypeSupCheckItem(checkType, supCheckItem);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查项表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitCheckItemSetNameDropDownList(FineUIPro.DropDownList dropName, string checkType, string supCheckItem, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "CheckItemName";
|
||||
dropName.DataTextField = "CheckItemName";
|
||||
dropName.DataSource = GetCheckItemSetListByCheckTypeSupCheckItem(checkType, supCheckItem);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user