92 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			92 lines
		
	
	
		
			4.2 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 TestRunRecordService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRecordId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.ProduceTestRun_TestRunRecord GetTestRunRecordById(string testRecordId) | |||
|  |         { | |||
|  |             return Funs.DB.ProduceTestRun_TestRunRecord.FirstOrDefault(e => e.TestRunRecordId == testRecordId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunRecord"></param> | |||
|  |         public static void AddTestRunRecord(Model.ProduceTestRun_TestRunRecord testRunRecord) | |||
|  |         { | |||
|  |             Model.ProduceTestRun_TestRunRecord newTestRunRecord = new Model.ProduceTestRun_TestRunRecord(); | |||
|  |             newTestRunRecord.TestRunRecordId = testRunRecord.TestRunRecordId; | |||
|  |             newTestRunRecord.ProjectId = testRunRecord.ProjectId; | |||
|  |             newTestRunRecord.UnitWorkId = testRunRecord.UnitWorkId; | |||
|  |             newTestRunRecord.UnitHead = testRunRecord.UnitHead; | |||
|  |             newTestRunRecord.RunRecord = testRunRecord.RunRecord; | |||
|  |             newTestRunRecord.TestRunRecordCode = testRunRecord.TestRunRecordCode; | |||
|  |             newTestRunRecord.RecordMan = testRunRecord.RecordMan; | |||
|  |             newTestRunRecord.StartDate = testRunRecord.StartDate; | |||
|  |             newTestRunRecord.EndDate = testRunRecord.EndDate; | |||
|  |             newTestRunRecord.Description = testRunRecord.Description; | |||
|  |             newTestRunRecord.ProblemsAndSolutions = testRunRecord.ProblemsAndSolutions; | |||
|  |             newTestRunRecord.AttachUrl = testRunRecord.AttachUrl; | |||
|  |             newTestRunRecord.Remark = testRunRecord.Remark; | |||
|  |             Funs.DB.ProduceTestRun_TestRunRecord.InsertOnSubmit(newTestRunRecord); | |||
|  |             Funs.DB.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunRecord"></param> | |||
|  |         public static void UpdateTestRunRecord(Model.ProduceTestRun_TestRunRecord testRunRecord) | |||
|  |         { | |||
|  |             Model.ProduceTestRun_TestRunRecord newTestRunRecord = Funs.DB.ProduceTestRun_TestRunRecord.FirstOrDefault(e => e.TestRunRecordId == testRunRecord.TestRunRecordId); | |||
|  |             if (newTestRunRecord != null) | |||
|  |             { | |||
|  |                 newTestRunRecord.ProjectId = testRunRecord.ProjectId; | |||
|  |                 newTestRunRecord.UnitWorkId = testRunRecord.UnitWorkId; | |||
|  |                 newTestRunRecord.UnitHead = testRunRecord.UnitHead; | |||
|  |                 newTestRunRecord.RunRecord = testRunRecord.RunRecord; | |||
|  |                 newTestRunRecord.TestRunRecordCode = testRunRecord.TestRunRecordCode; | |||
|  |                 newTestRunRecord.RecordMan = testRunRecord.RecordMan; | |||
|  |                 newTestRunRecord.StartDate = testRunRecord.StartDate; | |||
|  |                 newTestRunRecord.EndDate = testRunRecord.EndDate; | |||
|  |                 newTestRunRecord.Description = testRunRecord.Description; | |||
|  |                 newTestRunRecord.ProblemsAndSolutions = testRunRecord.ProblemsAndSolutions; | |||
|  |                 newTestRunRecord.AttachUrl = testRunRecord.AttachUrl; | |||
|  |                 newTestRunRecord.Remark = testRunRecord.Remark; | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除运行记录管理 | |||
|  |         /// </summary> | |||
|  |         /// <param name="testRunRecordId"></param> | |||
|  |         public static void DeleteTestRunRecordById(string testRunRecordId) | |||
|  |         { | |||
|  |             Model.ProduceTestRun_TestRunRecord newTestRunRecord = Funs.DB.ProduceTestRun_TestRunRecord.FirstOrDefault(e => e.TestRunRecordId == testRunRecordId); | |||
|  |             if (newTestRunRecord != null) | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(newTestRunRecord.AttachUrl)) | |||
|  |                 { | |||
|  |                     UploadAttachmentService.DeleteFile(Funs.RootPath, newTestRunRecord.AttachUrl); | |||
|  |                 } | |||
|  |                 Funs.DB.ProduceTestRun_TestRunRecord.DeleteOnSubmit(newTestRunRecord); | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |