112 lines
4.2 KiB
C#
112 lines
4.2 KiB
C#
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|