using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { /// /// 活动总结 /// public static class ThreeYearsOfTacklingTheRootCauseService { public static Model.SUBQHSEDB db = Funs.DB; /// /// 根据主键获取活动总结信息 /// /// /// public static Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause GetThreeYearsOfTacklingTheRootCauseById(string ThreeYearsOfTacklingTheRootCauseId) { return Funs.DB.SafetyActivities_ThreeYearsOfTacklingTheRootCause.FirstOrDefault(e => e.ThreeYearsOfTacklingTheRootCauseId == ThreeYearsOfTacklingTheRootCauseId); } /// /// 添加活动总结 /// /// 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(); } /// /// 修改 /// /// 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(); } } /// /// 删除 /// /// 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(); } } } }