90 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			4.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 DriverRunPlanService
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键获取开车保运计划
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunPlanId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.DriverRun_DriverRunPlan GetDriverRunPlanById(string driverRunPlanId)
 | 
						|
        {
 | 
						|
            return Funs.DB.DriverRun_DriverRunPlan.FirstOrDefault(e => e.DriverRunPlanId == driverRunPlanId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 添加开车保运计划
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunPlan"></param>
 | 
						|
        public static void AddDriverRunPlan(Model.DriverRun_DriverRunPlan driverRunPlan)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRunPlan newDriverRunPlan = new Model.DriverRun_DriverRunPlan();
 | 
						|
            newDriverRunPlan.DriverRunPlanId = driverRunPlan.DriverRunPlanId;
 | 
						|
            newDriverRunPlan.Code = driverRunPlan.Code;
 | 
						|
            newDriverRunPlan.ProjectId = driverRunPlan.ProjectId;
 | 
						|
            newDriverRunPlan.UnitId = driverRunPlan.UnitId;
 | 
						|
            newDriverRunPlan.EnterpriseDescription = driverRunPlan.EnterpriseDescription;
 | 
						|
            newDriverRunPlan.DriverRunPerformance = driverRunPlan.DriverRunPerformance;
 | 
						|
            newDriverRunPlan.TeamworkHistory = driverRunPlan.TeamworkHistory;
 | 
						|
            newDriverRunPlan.InstallationId = driverRunPlan.InstallationId;
 | 
						|
            newDriverRunPlan.InstallationNames = driverRunPlan.InstallationNames;
 | 
						|
            newDriverRunPlan.IsAcceptInvite = driverRunPlan.IsAcceptInvite;
 | 
						|
            newDriverRunPlan.AttachUrl = driverRunPlan.AttachUrl;
 | 
						|
            newDriverRunPlan.Remark = driverRunPlan.Remark;
 | 
						|
            Funs.DB.DriverRun_DriverRunPlan.InsertOnSubmit(newDriverRunPlan);
 | 
						|
            Funs.DB.SubmitChanges();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改开车保运计划
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunPlan"></param>
 | 
						|
        public static void UpdateDriverRunPlan(Model.DriverRun_DriverRunPlan driverRunPlan)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRunPlan newDriverRunPlan = Funs.DB.DriverRun_DriverRunPlan.FirstOrDefault(e => e.DriverRunPlanId == driverRunPlan.DriverRunPlanId);
 | 
						|
            if (newDriverRunPlan != null)
 | 
						|
            {
 | 
						|
                newDriverRunPlan.Code = driverRunPlan.Code;
 | 
						|
                newDriverRunPlan.ProjectId = driverRunPlan.ProjectId;
 | 
						|
                newDriverRunPlan.UnitId = driverRunPlan.UnitId;
 | 
						|
                newDriverRunPlan.EnterpriseDescription = driverRunPlan.EnterpriseDescription;
 | 
						|
                newDriverRunPlan.DriverRunPerformance = driverRunPlan.DriverRunPerformance;
 | 
						|
                newDriverRunPlan.TeamworkHistory = driverRunPlan.TeamworkHistory;
 | 
						|
                newDriverRunPlan.InstallationId = driverRunPlan.InstallationId;
 | 
						|
                newDriverRunPlan.InstallationNames = driverRunPlan.InstallationNames;
 | 
						|
                newDriverRunPlan.IsAcceptInvite = driverRunPlan.IsAcceptInvite;
 | 
						|
                newDriverRunPlan.AttachUrl = driverRunPlan.AttachUrl;
 | 
						|
                newDriverRunPlan.Remark = driverRunPlan.Remark;
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键删除开车保运计划
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="driverRunPlanId"></param>
 | 
						|
        public static void DeleteDriverRunPlanById(string driverRunPlanId)
 | 
						|
        {
 | 
						|
            Model.DriverRun_DriverRunPlan newDriverRunPlan = Funs.DB.DriverRun_DriverRunPlan.FirstOrDefault(e => e.DriverRunPlanId == driverRunPlanId);
 | 
						|
            if (newDriverRunPlan != null)
 | 
						|
            {
 | 
						|
                if (!string.IsNullOrEmpty(newDriverRunPlan.AttachUrl))
 | 
						|
                {
 | 
						|
                    UploadAttachmentService.DeleteFile(Funs.RootPath, newDriverRunPlan.AttachUrl);
 | 
						|
                }
 | 
						|
                Funs.DB.DriverRun_DriverRunPlan.DeleteOnSubmit(newDriverRunPlan);
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |