危害因素调整
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全问题分类
|
||||
/// </summary>
|
||||
public class SafetyProblemClassifyItemService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取安全问题分类明细信息
|
||||
/// </summary>
|
||||
/// <param name="ItemId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_SafetyProblemClassifyItem GetClassifyItemById(string ItemId)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
return db.Base_SafetyProblemClassifyItem.FirstOrDefault(e => e.ClassifyItemId == ItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加安全问题分类明细
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public static void AddClassifyItem(Model.Base_SafetyProblemClassifyItem model)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassifyItem newModel = new Model.Base_SafetyProblemClassifyItem();
|
||||
newModel.ClassifyItemId = model.ClassifyItemId;
|
||||
newModel.ClassifyId = model.ClassifyId;
|
||||
newModel.ClassifyItemCode = model.ClassifyItemCode;
|
||||
newModel.ClassifyItemName = model.ClassifyItemName;
|
||||
newModel.CompileMan = model.CompileMan;
|
||||
newModel.CompileManName = model.CompileManName;
|
||||
newModel.CompileDate = model.CompileDate;
|
||||
db.Base_SafetyProblemClassifyItem.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改安全问题分类明细
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
public static void UpdateClassifyItem(Model.Base_SafetyProblemClassifyItem model)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassifyItem newModel = db.Base_SafetyProblemClassifyItem.FirstOrDefault(e => e.ClassifyItemId == model.ClassifyItemId);
|
||||
if (newModel != null)
|
||||
{
|
||||
newModel.ClassifyId = model.ClassifyId;
|
||||
newModel.ClassifyItemCode = model.ClassifyItemCode;
|
||||
newModel.ClassifyItemName = model.ClassifyItemName;
|
||||
newModel.CompileMan = model.CompileMan;
|
||||
newModel.CompileManName = model.CompileManName;
|
||||
newModel.CompileDate = model.CompileDate;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除明细信息
|
||||
/// </summary>
|
||||
/// <param name="companyTrainItemId"></param>
|
||||
public static void DeleteClassifyItemById(string companyTrainItemId)
|
||||
{
|
||||
Model.CNPCDB db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassifyItem model = db.Base_SafetyProblemClassifyItem.FirstOrDefault(e => e.ClassifyItemId == companyTrainItemId);
|
||||
if (model != null)
|
||||
{
|
||||
db.Base_SafetyProblemClassifyItem.DeleteOnSubmit(model);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 教材库下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="workPostId">职务Id</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitClassifyItemDownList(FineUIPro.DropDownList dropName, string workPostId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ClassifyItemId";
|
||||
dropName.DataTextField = "ClassifyItemName";
|
||||
dropName.DataSource = GetClassifyItemList(workPostId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下拉项
|
||||
/// </summary>
|
||||
/// <param name="classifyId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_SafetyProblemClassifyItem> GetClassifyItemList(string classifyId)
|
||||
{
|
||||
var lst = (from x in Funs.DB.Base_SafetyProblemClassifyItem orderby x.ClassifyItemCode select x).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(classifyId))
|
||||
{
|
||||
lst = lst.Where(x => x.ClassifyId == classifyId).ToList();
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全问题分类主表
|
||||
/// </summary>
|
||||
public class SafetyProblemClassifyService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取安全问题分类
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_SafetyProblemClassify GetClassifyById(string Id)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
return db.Base_SafetyProblemClassify.FirstOrDefault(e => e.ClassifyId == Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加安全问题分类
|
||||
/// </summary>
|
||||
/// <param name="Classify"></param>
|
||||
public static void AddClassify(Model.Base_SafetyProblemClassify Classify)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassify newModel = new Model.Base_SafetyProblemClassify();
|
||||
newModel.ClassifyId = Classify.ClassifyId;
|
||||
newModel.ClassifyCode = Classify.ClassifyCode;
|
||||
newModel.ClassifyName = Classify.ClassifyName;
|
||||
db.Base_SafetyProblemClassify.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改安全问题分类
|
||||
/// </summary>
|
||||
/// <param name="Classify"></param>
|
||||
public static void UpdateClassify(Model.Base_SafetyProblemClassify Classify)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassify newModel = db.Base_SafetyProblemClassify.FirstOrDefault(e => e.ClassifyId == Classify.ClassifyId);
|
||||
if (newModel != null)
|
||||
{
|
||||
newModel.ClassifyCode = Classify.ClassifyCode;
|
||||
newModel.ClassifyName = Classify.ClassifyName;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除安全问题分类
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public static void DeleteClassify(string Id)
|
||||
{
|
||||
var db = Funs.DB;
|
||||
Model.Base_SafetyProblemClassify Classify = db.Base_SafetyProblemClassify.FirstOrDefault(e => e.ClassifyId == Id);
|
||||
if (Classify != null)
|
||||
{
|
||||
var getItems = from x in Funs.DB.Base_SafetyProblemClassifyItem
|
||||
where x.ClassifyId == Classify.ClassifyId
|
||||
select x;
|
||||
if (getItems.Count() > 0)
|
||||
{
|
||||
db.Base_SafetyProblemClassifyItem.DeleteAllOnSubmit(getItems);
|
||||
}
|
||||
db.Base_SafetyProblemClassify.DeleteOnSubmit(Classify);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 是否可删除资源节点
|
||||
///// </summary>
|
||||
///// <param name="postName"></param>
|
||||
///// <returns>true-可以,false-不可以</returns>
|
||||
//public static bool IsDeleteClassify(string Id)
|
||||
//{
|
||||
// bool isDelete = true;
|
||||
// var Training = BLL.SafetyProblemClassifyService.GetClassifyById(Id);
|
||||
// if (Training != null)
|
||||
// {
|
||||
// if (Training.IsEndLever == true)
|
||||
// {
|
||||
// var detailCout = Funs.DB.Training_ClassifyItem.FirstOrDefault(x => x.ClassifyId == Id);
|
||||
// if (detailCout != null)
|
||||
// {
|
||||
// isDelete = false;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var supItemSetCount = BLL.SafetyProblemClassifyService.GetClassifyBySupItem(Id);
|
||||
// if (supItemSetCount.Count() > 0)
|
||||
// {
|
||||
// isDelete = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return isDelete;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 查询所有安全问题分类
|
||||
/// </summary>
|
||||
/// <returns>安全问题分类的集合</returns>
|
||||
public static List<Model.Base_SafetyProblemClassify> GetClassify()
|
||||
{
|
||||
return (from x in Funs.DB.Base_SafetyProblemClassify
|
||||
orderby x.ClassifyCode
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型下拉框(末级)
|
||||
/// </summary>
|
||||
/// <param name="dropName"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="isShowPlease"></param>
|
||||
public static void InitClassifyIsEndDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ClassifyId";
|
||||
dropName.DataTextField = "ClassifyName";
|
||||
dropName.DataSource = GetClassify();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user