using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL; public class ProtectionStandardsService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取 /// /// /// public static Model.Technique_ProtectionStandards GetProtectionStandardsListById(string ProtectionStandardsId) { return Funs.DB.Technique_ProtectionStandards.FirstOrDefault(e => e.ProtectionStandardsId == ProtectionStandardsId); } /// /// 添加 /// /// public static void AddProtectionStandardsList(Model.Technique_ProtectionStandards ProtectionStandardsList) { Model.SGGLDB db = Funs.DB; Model.Technique_ProtectionStandards newProtectionStandardsList = new Model.Technique_ProtectionStandards { ProtectionStandardsId = ProtectionStandardsList.ProtectionStandardsId, ProtectionStandardsCode = ProtectionStandardsList.ProtectionStandardsCode, ProtectionStandardsName = ProtectionStandardsList.ProtectionStandardsName, AttachUrl = ProtectionStandardsList.AttachUrl, CompileMan = ProtectionStandardsList.CompileMan, CompileDate = ProtectionStandardsList.CompileDate, }; newProtectionStandardsList.CompileMan = ProtectionStandardsList.CompileMan; newProtectionStandardsList.CompileDate = ProtectionStandardsList.CompileDate; newProtectionStandardsList.IsPass = ProtectionStandardsList.IsPass; newProtectionStandardsList.UpState = ProtectionStandardsList.UpState; newProtectionStandardsList.Remark = ProtectionStandardsList.Remark; db.Technique_ProtectionStandards.InsertOnSubmit(newProtectionStandardsList); db.SubmitChanges(); } /// /// 修改 /// /// public static void UpdateProtectionStandardsList(Model.Technique_ProtectionStandards ProtectionStandardsList) { Model.SGGLDB db = Funs.DB; Model.Technique_ProtectionStandards newProtectionStandardsList = db.Technique_ProtectionStandards.FirstOrDefault(e => e.ProtectionStandardsId == ProtectionStandardsList.ProtectionStandardsId); if (newProtectionStandardsList != null) { newProtectionStandardsList.ProtectionStandardsCode = ProtectionStandardsList.ProtectionStandardsCode; newProtectionStandardsList.ProtectionStandardsName = ProtectionStandardsList.ProtectionStandardsName; newProtectionStandardsList.AttachUrl = ProtectionStandardsList.AttachUrl; newProtectionStandardsList.CompileMan = ProtectionStandardsList.CompileMan; newProtectionStandardsList.CompileDate = ProtectionStandardsList.CompileDate; newProtectionStandardsList.UpState = ProtectionStandardsList.UpState; newProtectionStandardsList.Remark = ProtectionStandardsList.Remark; db.SubmitChanges(); } } /// ///根据主键删除 /// /// public static void DeleteProtectionStandardsListById(string ProtectionStandardsId) { Model.SGGLDB db = Funs.DB; Model.Technique_ProtectionStandards ProtectionStandardsList = db.Technique_ProtectionStandards.FirstOrDefault(e => e.ProtectionStandardsId == ProtectionStandardsId); if (ProtectionStandardsList != null) { if (!string.IsNullOrEmpty(ProtectionStandardsList.AttachUrl)) { BLL.UploadFileService.DeleteFile(Funs.RootPath, ProtectionStandardsList.AttachUrl); } ////删除附件表 BLL.CommonService.DeleteAttachFileById(ProtectionStandardsList.ProtectionStandardsId); db.Technique_ProtectionStandards.DeleteOnSubmit(ProtectionStandardsList); db.SubmitChanges(); } } }