using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BLL { /// /// 运行报表管理 /// public static class TestRunReportService { /// /// 根据主键获取运行报表管理 /// /// /// public static Model.ProduceTestRun_TestRunReport GetTestRunReportById(string testRunReportId) { return Funs.DB.ProduceTestRun_TestRunReport.FirstOrDefault(e => e.TestRunReportId == testRunReportId); } /// /// 添加运行报表管理 /// /// public static void AddTestRunReport(Model.ProduceTestRun_TestRunReport testRunReport) { Model.ProduceTestRun_TestRunReport newTestRunReport = new Model.ProduceTestRun_TestRunReport(); newTestRunReport.TestRunReportId = testRunReport.TestRunReportId; newTestRunReport.ProjectId = testRunReport.ProjectId; newTestRunReport.UnitWorkId = testRunReport.UnitWorkId; newTestRunReport.UnitHead = testRunReport.UnitHead; newTestRunReport.TestRunReportName = testRunReport.TestRunReportName; newTestRunReport.TestRunReportCode = testRunReport.TestRunReportCode; newTestRunReport.CompileMan = testRunReport.CompileMan; newTestRunReport.StartDate = testRunReport.StartDate; newTestRunReport.EndDate = testRunReport.EndDate; newTestRunReport.AttachUrl = testRunReport.AttachUrl; newTestRunReport.Remark = testRunReport.Remark; Funs.DB.ProduceTestRun_TestRunReport.InsertOnSubmit(newTestRunReport); Funs.DB.SubmitChanges(); } /// /// 修改运行报表管理 /// /// public static void UpdateTestRunReport(Model.ProduceTestRun_TestRunReport testRunReport) { Model.ProduceTestRun_TestRunReport newTestRunReport = Funs.DB.ProduceTestRun_TestRunReport.FirstOrDefault(e => e.TestRunReportId == testRunReport.TestRunReportId); if (newTestRunReport != null) { newTestRunReport.ProjectId = testRunReport.ProjectId; newTestRunReport.UnitWorkId = testRunReport.UnitWorkId; newTestRunReport.UnitHead = testRunReport.UnitHead; newTestRunReport.TestRunReportName = testRunReport.TestRunReportName; newTestRunReport.TestRunReportCode = testRunReport.TestRunReportCode; newTestRunReport.CompileMan = testRunReport.CompileMan; newTestRunReport.StartDate = testRunReport.StartDate; newTestRunReport.EndDate = testRunReport.EndDate; newTestRunReport.AttachUrl = testRunReport.AttachUrl; newTestRunReport.Remark = testRunReport.Remark; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除运行报表管理 /// /// public static void DeleteTestRunReportById(string testRunReportId) { Model.ProduceTestRun_TestRunReport newTestRunReport = Funs.DB.ProduceTestRun_TestRunReport.FirstOrDefault(e => e.TestRunReportId == testRunReportId); if (newTestRunReport != null) { if (!string.IsNullOrEmpty(newTestRunReport.AttachUrl)) { UploadAttachmentService.DeleteFile(Funs.RootPath, newTestRunReport.AttachUrl); } Funs.DB.ProduceTestRun_TestRunReport.DeleteOnSubmit(newTestRunReport); Funs.DB.SubmitChanges(); } } } }