88 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			88 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     /// <summary> | |||
|  |     /// 运行报表管理 | |||
|  |     /// </summary> | |||
|  |     public static class TestRunReportService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取运行报表管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunReportId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.ProduceTestRun_TestRunReport GetTestRunReportById(string testRunReportId) | |||
|  |         { | |||
|  |             return Funs.DB.ProduceTestRun_TestRunReport.FirstOrDefault(e => e.TestRunReportId == testRunReportId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加运行报表管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunReport"></param> | |||
|  |         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(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改运行报表管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunReport"></param> | |||
|  |         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(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除运行报表管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunReportId"></param> | |||
|  |         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(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |