using System.Linq; namespace BLL { /// /// 国内现行相关标准规范 /// public static class FileControl_DomesticStandardsService { /// /// 根据主键获取国内现行相关标准规范 /// /// /// public static Model.FileControl_DomesticStandards GetDomesticStandardsById(string domesticStandardsId) { return Funs.DB.FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == domesticStandardsId); } /// /// 添加国内现行相关标准规范 /// /// public static void AddDomesticStandards(Model.FileControl_DomesticStandards domesticStandards) { Model.HJGLDB db = Funs.DB; Model.FileControl_DomesticStandards newDomesticStandards = new Model.FileControl_DomesticStandards(); newDomesticStandards.DomesticStandardsId = domesticStandards.DomesticStandardsId; newDomesticStandards.DomesticStandardsCode = domesticStandards.DomesticStandardsCode; newDomesticStandards.DomesticStandardsName = domesticStandards.DomesticStandardsName; newDomesticStandards.Abstract = domesticStandards.Abstract; newDomesticStandards.CompileMan = domesticStandards.CompileMan; newDomesticStandards.CompileDate = domesticStandards.CompileDate; newDomesticStandards.Remarks = domesticStandards.Remarks; newDomesticStandards.AttachUrl = domesticStandards.AttachUrl; db.FileControl_DomesticStandards.InsertOnSubmit(newDomesticStandards); db.SubmitChanges(); } /// /// 修改国内现行相关标准规范 /// /// public static void UpdateDomesticStandards(Model.FileControl_DomesticStandards domesticStandards) { Model.HJGLDB db = Funs.DB; Model.FileControl_DomesticStandards newDomesticStandards = db.FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == domesticStandards.DomesticStandardsId); if (newDomesticStandards != null) { newDomesticStandards.DomesticStandardsCode = domesticStandards.DomesticStandardsCode; newDomesticStandards.DomesticStandardsName = domesticStandards.DomesticStandardsName; newDomesticStandards.Abstract = domesticStandards.Abstract; newDomesticStandards.CompileMan = domesticStandards.CompileMan; newDomesticStandards.CompileDate = domesticStandards.CompileDate; newDomesticStandards.Remarks = domesticStandards.Remarks; newDomesticStandards.AttachUrl = domesticStandards.AttachUrl; db.SubmitChanges(); } } /// /// 根据主键删除国内现行相关标准规范 /// /// public static void DeleteDomesticStandardsById(string domesticStandardsId) { Model.HJGLDB db = Funs.DB; Model.FileControl_DomesticStandards domesticStandards = db.FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == domesticStandardsId); if (domesticStandards != null) { BLL.AttachFileService.DeleteAttachFile(Funs.RootPath, domesticStandardsId, Const.DomesticStandardsMenuId);//删除附件 db.FileControl_DomesticStandards.DeleteOnSubmit(domesticStandards); db.SubmitChanges(); } } } }