113 lines
3.6 KiB
C#
113 lines
3.6 KiB
C#
using Model;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 岗位培训角色
|
|
/// </summary>
|
|
public static class PostTrainingRoleService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取岗位培训角色信息
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public static Model.PostTraining_Role GetRoleById(string Id)
|
|
{
|
|
return Funs.DB.PostTraining_Role.FirstOrDefault(e => e.Id == Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加岗位培训角色
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void AddRole(Model.PostTraining_Role model)
|
|
{
|
|
Model.PostTraining_Role newModel = new Model.PostTraining_Role
|
|
{
|
|
Id = model.Id,
|
|
Code = model.Code,
|
|
Name = model.Name,
|
|
CompileDate = model.CompileDate,
|
|
CompileMan = model.CompileMan,
|
|
Remark = model.Remark
|
|
};
|
|
Funs.DB.PostTraining_Role.InsertOnSubmit(newModel);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void UpdateRole(Model.PostTraining_Role model)
|
|
{
|
|
Model.PostTraining_Role newModel = Funs.DB.PostTraining_Role.FirstOrDefault(e => e.Id == model.Id);
|
|
if (newModel != null)
|
|
{
|
|
newModel.Code = model.Code;
|
|
newModel.Name = model.Name;
|
|
newModel.Remark = model.Remark;
|
|
<<<<<<< HEAD
|
|
=======
|
|
newModel.CompileDate = model.CompileDate;
|
|
newModel.CompileMan = model.CompileMan;
|
|
>>>>>>> 7396d1b654f9a1d0172b2ac898a20175abe94d74
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
public static void DeleteRoleById(string Id)
|
|
{
|
|
Model.PostTraining_Role model = Funs.DB.PostTraining_Role.FirstOrDefault(e => e.Id == Id);
|
|
if (model != null)
|
|
{
|
|
CommonService.DeleteAttachFileById(Id);
|
|
Funs.DB.PostTraining_Role.DeleteOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有岗位培训角色List
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<PostTraining_Role> GetRoleList()
|
|
{
|
|
return (from x in Funs.DB.PostTraining_Role orderby x.Code select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取岗位培训角色下拉框
|
|
/// </summary>
|
|
/// <param name="dropName"></param>
|
|
/// <param name="isShowPlease"></param>
|
|
public static void InitPostTrainingRoleDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Id";
|
|
dropName.DataTextField = "Name";
|
|
dropName.DataSource = GetPostTrainingRoleList();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取岗位培训角色下拉项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.PostTraining_Role> GetPostTrainingRoleList()
|
|
{
|
|
return (from x in Funs.DB.PostTraining_Role orderby x.Code select x).ToList();
|
|
}
|
|
}
|
|
}
|