using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
///
/// 开车保运计划
///
public static class DriverRunPlanService
{
///
/// 根据主键获取开车保运计划
///
///
///
public static Model.DriverRun_DriverRunPlan GetDriverRunPlanById(string driverRunPlanId)
{
return Funs.DB.DriverRun_DriverRunPlan.FirstOrDefault(e => e.DriverRunPlanId == driverRunPlanId);
}
///
/// 添加开车保运计划
///
///
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.EstimatedInsuredPersonNum = driverRunPlan.EstimatedInsuredPersonNum;
newDriverRunPlan.GuaranteedOperationPeriod = driverRunPlan.GuaranteedOperationPeriod;
newDriverRunPlan.TotalGuaranteedOperationDays = driverRunPlan.TotalGuaranteedOperationDays;
newDriverRunPlan.Remark = driverRunPlan.Remark;
Funs.DB.DriverRun_DriverRunPlan.InsertOnSubmit(newDriverRunPlan);
Funs.DB.SubmitChanges();
}
///
/// 修改开车保运计划
///
///
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.EstimatedInsuredPersonNum = driverRunPlan.EstimatedInsuredPersonNum;
newDriverRunPlan.GuaranteedOperationPeriod = driverRunPlan.GuaranteedOperationPeriod;
newDriverRunPlan.TotalGuaranteedOperationDays = driverRunPlan.TotalGuaranteedOperationDays;
newDriverRunPlan.Remark = driverRunPlan.Remark;
Funs.DB.SubmitChanges();
}
}
///
/// 根据主键删除开车保运计划
///
///
public static void DeleteDriverRunPlanById(string driverRunPlanId)
{
Model.DriverRun_DriverRunPlan newDriverRunPlan = Funs.DB.DriverRun_DriverRunPlan.FirstOrDefault(e => e.DriverRunPlanId == driverRunPlanId);
if (newDriverRunPlan != null)
{
////删除附件表
BLL.CommonService.DeleteAttachFileById(newDriverRunPlan.DriverRunPlanId);
BLL.CommonService.DeleteAttachFileById(newDriverRunPlan.DriverRunPlanId + "K");
Funs.DB.DriverRun_DriverRunPlan.DeleteOnSubmit(newDriverRunPlan);
Funs.DB.SubmitChanges();
}
}
}
}