89 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			3.3 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 TestRunService
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键获取试车管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="testRunId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.Driver_TestRun GetTestRunById(string testRunId)
 | 
						|
        {
 | 
						|
            return Funs.DB.Driver_TestRun.FirstOrDefault(e => e.TestRunId == testRunId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 添加试车管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="testRun"></param>
 | 
						|
        public static void AddTestRun(Model.Driver_TestRun testRun)
 | 
						|
        {
 | 
						|
            Model.Driver_TestRun newTestRun = new Model.Driver_TestRun();
 | 
						|
            newTestRun.TestRunId = testRun.TestRunId;
 | 
						|
            newTestRun.ProjectId = testRun.ProjectId;
 | 
						|
            newTestRun.Code = testRun.Code;
 | 
						|
            newTestRun.UnitWorkId = testRun.UnitWorkId;
 | 
						|
            newTestRun.InstallationHead = testRun.InstallationHead;
 | 
						|
            newTestRun.WorkContents = testRun.WorkContents;
 | 
						|
            newTestRun.StartDate = testRun.StartDate;
 | 
						|
            newTestRun.EndDate = testRun.EndDate;
 | 
						|
            newTestRun.Descriptions = testRun.Descriptions;
 | 
						|
            newTestRun.ProblemsAndSolutions = testRun.ProblemsAndSolutions;
 | 
						|
            newTestRun.AttachUrl = testRun.AttachUrl;
 | 
						|
            newTestRun.Remark = testRun.Remark;
 | 
						|
            Funs.DB.Driver_TestRun.InsertOnSubmit(newTestRun);
 | 
						|
            Funs.DB.SubmitChanges();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改试车管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="testRun"></param>
 | 
						|
        public static void UpdateTestRun(Model.Driver_TestRun testRun)
 | 
						|
        {
 | 
						|
            Model.Driver_TestRun newTestRun = Funs.DB.Driver_TestRun.FirstOrDefault(e => e.TestRunId == testRun.TestRunId);
 | 
						|
            if (newTestRun != null)
 | 
						|
            {
 | 
						|
                newTestRun.Code = testRun.Code;
 | 
						|
                newTestRun.UnitWorkId = testRun.UnitWorkId;
 | 
						|
                newTestRun.InstallationHead = testRun.InstallationHead;
 | 
						|
                newTestRun.WorkContents = testRun.WorkContents;
 | 
						|
                newTestRun.StartDate = testRun.StartDate;
 | 
						|
                newTestRun.EndDate = testRun.EndDate;
 | 
						|
                newTestRun.Descriptions = testRun.Descriptions;
 | 
						|
                newTestRun.ProblemsAndSolutions = testRun.ProblemsAndSolutions;
 | 
						|
                newTestRun.AttachUrl = testRun.AttachUrl;
 | 
						|
                newTestRun.Remark = testRun.Remark;
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键删除试车管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="testRunId"></param>
 | 
						|
        public static void DeleteTestRunById(string testRunId)
 | 
						|
        {
 | 
						|
            Model.Driver_TestRun newTestRun = Funs.DB.Driver_TestRun.FirstOrDefault(e => e.TestRunId == testRunId);
 | 
						|
            if (newTestRun != null)
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(newTestRun.AttachUrl))
 | 
						|
                {
 | 
						|
                    UploadAttachmentService.DeleteFile(Funs.RootPath, newTestRun.AttachUrl);
 | 
						|
                }
 | 
						|
                Funs.DB.Driver_TestRun.DeleteOnSubmit(newTestRun);
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |