using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { /// /// 环评报告 /// public static class EIAReportService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取环评报告 /// /// /// public static Model.Environmental_EIAReport GetEIAReportById(string fileId) { return Funs.DB.Environmental_EIAReport.FirstOrDefault(e => e.FileId == fileId); } /// /// 添加环评报告 /// /// public static void AddEIAReport(Model.Environmental_EIAReport EIAReport) { Model.SGGLDB db = Funs.DB; Model.Environmental_EIAReport newEIAReport = new Model.Environmental_EIAReport { FileId = EIAReport.FileId, FileCode = EIAReport.FileCode, ProjectId = EIAReport.ProjectId, FileName = EIAReport.FileName, FileContent = EIAReport.FileContent, CompileMan = EIAReport.CompileMan, CompileDate = EIAReport.CompileDate, AttachUrl = EIAReport.AttachUrl, States = EIAReport.States }; db.Environmental_EIAReport.InsertOnSubmit(newEIAReport); db.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.EIAReportMenuId, EIAReport.ProjectId, null, EIAReport.FileId, EIAReport.CompileDate); } /// /// 修改环评报告 /// /// public static void UpdateEIAReport(Model.Environmental_EIAReport EIAReport) { Model.SGGLDB db = Funs.DB; Model.Environmental_EIAReport newEIAReport = db.Environmental_EIAReport.FirstOrDefault(e => e.FileId == EIAReport.FileId); if (newEIAReport != null) { newEIAReport.FileCode = EIAReport.FileCode; newEIAReport.FileName = EIAReport.FileName; newEIAReport.FileContent = EIAReport.FileContent; newEIAReport.CompileMan = EIAReport.CompileMan; newEIAReport.CompileDate = EIAReport.CompileDate; newEIAReport.AttachUrl = EIAReport.AttachUrl; newEIAReport.States = EIAReport.States; db.SubmitChanges(); } } /// /// 根据主键删除环评报告 /// /// public static void DeleteEIAReportById(string FileId) { Model.SGGLDB db = Funs.DB; Model.Environmental_EIAReport EIAReport = db.Environmental_EIAReport.FirstOrDefault(e => e.FileId == FileId); if (EIAReport != null) { ///删除编码表记录 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(FileId); ////删除附件表 BLL.CommonService.DeleteAttachFileById(EIAReport.FileId); BLL.CommonService.DeleteFlowOperateByID(FileId); db.Environmental_EIAReport.DeleteOnSubmit(EIAReport); db.SubmitChanges(); } } } }