using System.Linq;
namespace BLL
{
///
/// 个人安全行动计划
///
public static class PersonalSafetyActionPlanService
{
///
/// 根据主键获取个人安全行动计划信息
///
///
///
public static Model.Examine_PersonalSafetyActionPlan GetPersonalSafetyActionPlanById(string Id)
{
return Funs.DB.Examine_PersonalSafetyActionPlan.FirstOrDefault(e => e.Id == Id);
}
///
/// 添加个人安全行动计划
///
///
public static void AddPersonalSafetyActionPlan(Model.Examine_PersonalSafetyActionPlan model)
{
Model.Examine_PersonalSafetyActionPlan newModel = new Model.Examine_PersonalSafetyActionPlan
{
Id = model.Id,
ProjectId = model.ProjectId,
Code = model.Code,
Name = model.Name,
UserId = model.UserId,
DateTime = model.DateTime,
CompileDate = model.CompileDate,
CompileMan = model.CompileMan,
Remark = model.Remark,
Content = model.Content
};
Funs.DB.Examine_PersonalSafetyActionPlan.InsertOnSubmit(newModel);
Funs.DB.SubmitChanges();
}
///
/// 修改
///
///
public static void UpdatePersonalSafetyActionPlan(Model.Examine_PersonalSafetyActionPlan model)
{
Model.Examine_PersonalSafetyActionPlan newModel = Funs.DB.Examine_PersonalSafetyActionPlan.FirstOrDefault(e => e.Id == model.Id);
if (newModel != null)
{
newModel.Code = model.Code;
newModel.Name = model.Name;
newModel.UserId = model.UserId;
newModel.DateTime = model.DateTime;
newModel.Content = model.Content;
newModel.Remark = model.Remark;
Funs.DB.SubmitChanges();
}
}
///
/// 删除
///
///
public static void DeletePersonalSafetyActionPlanById(string Id)
{
Model.Examine_PersonalSafetyActionPlan model = Funs.DB.Examine_PersonalSafetyActionPlan.FirstOrDefault(e => e.Id == Id);
if (model != null)
{
CommonService.DeleteAttachFileById(Id);
Funs.DB.Examine_PersonalSafetyActionPlan.DeleteOnSubmit(model);
Funs.DB.SubmitChanges();
}
}
}
}