SGGL_JT/SUBQHSE/BLL/HSSE/SafetyActivities/ThreeYearsOfTacklingTheRoot...

89 lines
4.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 活动总结
/// </summary>
public static class ThreeYearsOfTacklingTheRootCauseService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 根据主键获取活动总结信息
/// </summary>
/// <param name="ThreeYearsOfTacklingTheRootCauseId"></param>
/// <returns></returns>
public static Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause GetThreeYearsOfTacklingTheRootCauseById(string ThreeYearsOfTacklingTheRootCauseId)
{
return Funs.DB.SafetyActivities_ThreeYearsOfTacklingTheRootCause.FirstOrDefault(e => e.ThreeYearsOfTacklingTheRootCauseId == ThreeYearsOfTacklingTheRootCauseId);
}
/// <summary>
/// 添加活动总结
/// </summary>
/// <param name="ThreeYearsOfTacklingTheRootCause"></param>
public static void AddThreeYearsOfTacklingTheRootCause(Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause ThreeYearsOfTacklingTheRootCause)
{
Model.SUBQHSEDB db = Funs.DB;
Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause newThreeYearsOfTacklingTheRootCause = new Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause
{
ThreeYearsOfTacklingTheRootCauseId = ThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId,
ProjectId = ThreeYearsOfTacklingTheRootCause.ProjectId,
UnitId = ThreeYearsOfTacklingTheRootCause.UnitId,
Title = ThreeYearsOfTacklingTheRootCause.Title,
CompileDate = ThreeYearsOfTacklingTheRootCause.CompileDate,
EndTime = ThreeYearsOfTacklingTheRootCause.EndTime,
CompileMan = ThreeYearsOfTacklingTheRootCause.CompileMan,
Remark = ThreeYearsOfTacklingTheRootCause.Remark,
AttachUrl = ThreeYearsOfTacklingTheRootCause.AttachUrl,
SeeFile = ThreeYearsOfTacklingTheRootCause.SeeFile
};
db.SafetyActivities_ThreeYearsOfTacklingTheRootCause.InsertOnSubmit(newThreeYearsOfTacklingTheRootCause);
db.SubmitChanges();
}
/// <summary>
/// 修改
/// </summary>
/// <param name="ThreeYearsOfTacklingTheRootCause"></param>
public static void UpdateThreeYearsOfTacklingTheRootCause(Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause ThreeYearsOfTacklingTheRootCause)
{
Model.SUBQHSEDB db = Funs.DB;
Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause newThreeYearsOfTacklingTheRootCause = db.SafetyActivities_ThreeYearsOfTacklingTheRootCause.FirstOrDefault(e => e.ThreeYearsOfTacklingTheRootCauseId == ThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId);
if (newThreeYearsOfTacklingTheRootCause != null)
{
newThreeYearsOfTacklingTheRootCause.Title = ThreeYearsOfTacklingTheRootCause.Title;
newThreeYearsOfTacklingTheRootCause.CompileDate = ThreeYearsOfTacklingTheRootCause.CompileDate;
newThreeYearsOfTacklingTheRootCause.EndTime = ThreeYearsOfTacklingTheRootCause.EndTime;
newThreeYearsOfTacklingTheRootCause.CompileMan = ThreeYearsOfTacklingTheRootCause.CompileMan;
newThreeYearsOfTacklingTheRootCause.Remark = ThreeYearsOfTacklingTheRootCause.Remark;
newThreeYearsOfTacklingTheRootCause.AttachUrl = ThreeYearsOfTacklingTheRootCause.AttachUrl;
newThreeYearsOfTacklingTheRootCause.SeeFile = ThreeYearsOfTacklingTheRootCause.SeeFile;
db.SubmitChanges();
}
}
/// <summary>
/// 删除
/// </summary>
/// <param name="ThreeYearsOfTacklingTheRootCauseId"></param>
public static void DeleteThreeYearsOfTacklingTheRootCauseById(string ThreeYearsOfTacklingTheRootCauseId)
{
Model.SUBQHSEDB db = Funs.DB;
Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause ThreeYearsOfTacklingTheRootCause = db.SafetyActivities_ThreeYearsOfTacklingTheRootCause.FirstOrDefault(e => e.ThreeYearsOfTacklingTheRootCauseId == ThreeYearsOfTacklingTheRootCauseId);
if (ThreeYearsOfTacklingTheRootCause != null)
{
if (!string.IsNullOrEmpty(ThreeYearsOfTacklingTheRootCause.AttachUrl))
{
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, ThreeYearsOfTacklingTheRootCause.AttachUrl);//删除附件
}
db.SafetyActivities_ThreeYearsOfTacklingTheRootCause.DeleteOnSubmit(ThreeYearsOfTacklingTheRootCause);
db.SubmitChanges();
}
}
}
}