122 lines
3.9 KiB
C#
122 lines
3.9 KiB
C#
using Model;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 岗位培训类别
|
|
/// </summary>
|
|
public static class PostTrainingCategoryService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取岗位培训类别信息
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public static Model.PostTraining_Category GetCategoryById(string Id)
|
|
{
|
|
return Funs.DB.PostTraining_Category.FirstOrDefault(e => e.Id == Id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据名称获取岗位培训类别信息
|
|
/// </summary>
|
|
/// <param name="Name"></param>
|
|
/// <returns></returns>
|
|
public static Model.PostTraining_Category GetCategoryByName(string Name)
|
|
{
|
|
return Funs.DB.PostTraining_Category.FirstOrDefault(e => e.Name == Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加岗位培训类别
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void AddCategory(Model.PostTraining_Category model)
|
|
{
|
|
Model.PostTraining_Category newModel = new Model.PostTraining_Category
|
|
{
|
|
Id = model.Id,
|
|
Code = model.Code,
|
|
Name = model.Name,
|
|
CompileDate = model.CompileDate,
|
|
CompileMan = model.CompileMan,
|
|
Remark = model.Remark
|
|
};
|
|
Funs.DB.PostTraining_Category.InsertOnSubmit(newModel);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
public static void UpdateCategory(Model.PostTraining_Category model)
|
|
{
|
|
Model.PostTraining_Category newModel = Funs.DB.PostTraining_Category.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 DeleteCategoryById(string Id)
|
|
{
|
|
Model.PostTraining_Category model = Funs.DB.PostTraining_Category.FirstOrDefault(e => e.Id == Id);
|
|
if (model != null)
|
|
{
|
|
CommonService.DeleteAttachFileById(Id);
|
|
Funs.DB.PostTraining_Category.DeleteOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有培训类别List
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<PostTraining_Category> GetCategoryList()
|
|
{
|
|
return (from x in Funs.DB.PostTraining_Category orderby x.Code select x).ToList();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取培训类别下拉框
|
|
/// </summary>
|
|
/// <param name="dropName"></param>
|
|
/// <param name="isShowPlease"></param>
|
|
public static void InitPostTrainingCategoryDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Id";
|
|
dropName.DataTextField = "Name";
|
|
dropName.DataSource = GetPostTrainingCategoryList();
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取培训类别下拉项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.PostTraining_Category> GetPostTrainingCategoryList()
|
|
{
|
|
return (from x in Funs.DB.PostTraining_Category orderby x.Code select x).ToList();
|
|
}
|
|
|
|
}
|
|
}
|