using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { /// /// 国内现行相关标准规范 /// public static class HJGL_FileControl_DomesticStandardsService { /// /// 根据主键获取国内现行相关标准规范 /// /// /// public static Model.HJGL_FileControl_DomesticStandards GetDomesticStandardsById(string DomesticStandardsId) { return Funs.DB.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandardsId); } /// /// 添加国内现行相关标准规范 /// /// public static void AddDomesticStandards(Model.HJGL_FileControl_DomesticStandards DomesticStandards) { Model.SGGLDB db = Funs.DB; Model.HJGL_FileControl_DomesticStandards newDomesticStandards = new Model.HJGL_FileControl_DomesticStandards(); newDomesticStandards.DomesticStandardsId = DomesticStandards.DomesticStandardsId; newDomesticStandards.DomesticStandardsCode = DomesticStandards.DomesticStandardsCode; newDomesticStandards.DomesticStandardsName = DomesticStandards.DomesticStandardsName; newDomesticStandards.Summary = DomesticStandards.Summary; newDomesticStandards.CompileDate = DomesticStandards.CompileDate; newDomesticStandards.AttachUrl = DomesticStandards.AttachUrl; newDomesticStandards.CompileMan = DomesticStandards.CompileMan; newDomesticStandards.CompileDate = DomesticStandards.CompileDate; newDomesticStandards.Remarks = DomesticStandards.Remarks; db.HJGL_FileControl_DomesticStandards.InsertOnSubmit(newDomesticStandards); db.SubmitChanges(); } /// /// 修改国内现行相关标准规范 /// /// public static void UpdateDomesticStandards(Model.HJGL_FileControl_DomesticStandards DomesticStandards) { Model.SGGLDB db = Funs.DB; Model.HJGL_FileControl_DomesticStandards newDomesticStandards = db.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandards.DomesticStandardsId); if (newDomesticStandards != null) { newDomesticStandards.DomesticStandardsCode = DomesticStandards.DomesticStandardsCode; newDomesticStandards.DomesticStandardsName = DomesticStandards.DomesticStandardsName; newDomesticStandards.Summary = DomesticStandards.Summary; newDomesticStandards.CompileDate = DomesticStandards.CompileDate; newDomesticStandards.AttachUrl = DomesticStandards.AttachUrl; newDomesticStandards.CompileMan = DomesticStandards.CompileMan; newDomesticStandards.CompileDate = DomesticStandards.CompileDate; newDomesticStandards.Remarks = DomesticStandards.Remarks; db.SubmitChanges(); } } /// /// 根据主键删除国内现行相关标准规范 /// /// public static void DeleteDomesticStandardsById(string DomesticStandardsId) { Model.SGGLDB db = Funs.DB; Model.HJGL_FileControl_DomesticStandards DomesticStandards = db.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandardsId); if (DomesticStandards != null) { if (!string.IsNullOrEmpty(DomesticStandards.AttachUrl)) { BLL.UploadFileService.DeleteFile(Funs.RootPath, DomesticStandards.AttachUrl);//删除附件 } BLL.AttachFileService.DeleteAttachFile(Funs.RootPath, DomesticStandardsId, Const.HJGLServer_DomesticStandardsMenuId);//删除附件 db.HJGL_FileControl_DomesticStandards.DeleteOnSubmit(DomesticStandards); db.SubmitChanges(); } } } }