130 lines
4.2 KiB
C#
130 lines
4.2 KiB
C#
using Model;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 岗位培训方式
|
|
/// </summary>
|
|
public static class PostTrainingMethodService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取岗位培训方式信息
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public static Model.PostTraining_Method GetMethodById(string Id)
|
|
{
|
|
return Funs.DB.PostTraining_Method.FirstOrDefault(e => e.Id == Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据名称获取岗位培训方式信息
|
|
/// </summary>
|
|
/// <param name="Name"></param>
|
|
/// <returns></returns>
|
|
public static Model.PostTraining_Method GetMethodByName(string Name)
|
|
{
|
|
return Funs.DB.PostTraining_Method.FirstOrDefault(e => e.Name == Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加岗位培训方式
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void AddMethod(Model.PostTraining_Method model)
|
|
{
|
|
Model.PostTraining_Method newModel = new Model.PostTraining_Method
|
|
{
|
|
Id = model.Id,
|
|
Code = model.Code,
|
|
Name = model.Name,
|
|
CompileDate = model.CompileDate,
|
|
CompileMan = model.CompileMan,
|
|
Remark = model.Remark
|
|
};
|
|
Funs.DB.PostTraining_Method.InsertOnSubmit(newModel);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void UpdateMethod(Model.PostTraining_Method model)
|
|
{
|
|
Model.PostTraining_Method newModel = Funs.DB.PostTraining_Method.FirstOrDefault(e => e.Id == model.Id);
|
|
if (newModel != null)
|
|
{
|
|
newModel.Code = model.Code;
|
|
newModel.Name = model.Name;
|
|
newModel.Remark = model.Remark;
|
|
newModel.CompileDate = model.CompileDate;
|
|
newModel.CompileMan = model.CompileMan;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
public static void DeleteMethodById(string Id)
|
|
{
|
|
Model.PostTraining_Method model = Funs.DB.PostTraining_Method.FirstOrDefault(e => e.Id == Id);
|
|
if (model != null)
|
|
{
|
|
CommonService.DeleteAttachFileById(Id);
|
|
Funs.DB.PostTraining_Method.DeleteOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取所有培训方式List
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<PostTraining_Method> GetMethodList()
|
|
{
|
|
return (from x in Funs.DB.PostTraining_Method orderby x.Code select x).ToList();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取培训方式下拉框
|
|
/// </summary>
|
|
/// <param name="dropName"></param>
|
|
/// <param name="excludeName"></param>
|
|
/// <param name="isShowPlease"></param>
|
|
public static void InitPostTrainingMethodDropDownList(FineUIPro.DropDownList dropName, string excludeName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Name";
|
|
dropName.DataTextField = "Name";
|
|
dropName.DataSource = GetPostTrainingMethodList(excludeName);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取培训方式下拉项
|
|
/// </summary>
|
|
/// <param name="excludeName"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.PostTraining_Method> GetPostTrainingMethodList(string excludeName)
|
|
{
|
|
var lst = (from x in Funs.DB.PostTraining_Method orderby x.Code select x).ToList();
|
|
if (!string.IsNullOrWhiteSpace(excludeName))
|
|
{
|
|
lst = lst.Where(x => x.Name != excludeName).ToList();
|
|
}
|
|
return lst;
|
|
}
|
|
|
|
}
|
|
}
|