82 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			3.1 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 DriverRunService
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键获取开车保运管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.DriverRun_DriverRun GetDriverRunById(string driverRunId)
 | 
						|
        {
 | 
						|
            return Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRunId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 添加开车保运管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRun"></param>
 | 
						|
        public static void AddDriverRun(Model.DriverRun_DriverRun driverRun)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRun newDriverRun = new Model.DriverRun_DriverRun();
 | 
						|
            newDriverRun.DriverRunId = driverRun.DriverRunId;
 | 
						|
            newDriverRun.ProjectId = driverRun.ProjectId;
 | 
						|
            newDriverRun.Code = driverRun.Code;
 | 
						|
            newDriverRun.UnitId = driverRun.UnitId;
 | 
						|
            newDriverRun.Implement = driverRun.Implement;
 | 
						|
            newDriverRun.Descriptions = driverRun.Descriptions;
 | 
						|
            newDriverRun.AttachUrl = driverRun.AttachUrl;
 | 
						|
            newDriverRun.Remark = driverRun.Remark;
 | 
						|
            Funs.DB.DriverRun_DriverRun.InsertOnSubmit(newDriverRun);
 | 
						|
            Funs.DB.SubmitChanges();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改开车保运管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRun"></param>
 | 
						|
        public static void UpdateDriverRun(Model.DriverRun_DriverRun driverRun)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRun newDriverRun = Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRun.DriverRunId);
 | 
						|
            if (newDriverRun != null)
 | 
						|
            {
 | 
						|
                newDriverRun.ProjectId = driverRun.ProjectId;
 | 
						|
                newDriverRun.Code = driverRun.Code;
 | 
						|
                newDriverRun.UnitId = driverRun.UnitId;
 | 
						|
                newDriverRun.Implement = driverRun.Implement;
 | 
						|
                newDriverRun.Descriptions = driverRun.Descriptions;
 | 
						|
                newDriverRun.AttachUrl = driverRun.AttachUrl;
 | 
						|
                newDriverRun.Remark = driverRun.Remark;
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键删除开车保运管理
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunId"></param>
 | 
						|
        public static void DeleteDriverRunById(string driverRunId)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRun newDriverRun = Funs.DB.DriverRun_DriverRun.FirstOrDefault(e => e.DriverRunId == driverRunId);
 | 
						|
            if (newDriverRun != null)
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(newDriverRun.AttachUrl))
 | 
						|
                {
 | 
						|
                    UploadAttachmentService.DeleteFile(Funs.RootPath, newDriverRun.AttachUrl);
 | 
						|
                }
 | 
						|
                Funs.DB.DriverRun_DriverRun.DeleteOnSubmit(newDriverRun);
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |