xinjiang/SGGL/BLL/TestRun/DriverSub/DriverSubPlanService.cs

89 lines
3.9 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 DriverSubPlanService
{
/// <summary>
/// 根据主键获取开车分包计划信息
/// </summary>
/// <param name="DriverSubPlanId"></param>
/// <returns></returns>
public static Model.DriverSub_DriverSubPlan GetDriverSubPlanById(string DriverSubPlanId)
{
return Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlanId);
}
/// <summary>
/// 添加开车分包计划信息
/// </summary>
/// <param name="DriverSubPlan"></param>
public static void AddDriverSubPlan(Model.DriverSub_DriverSubPlan DriverSubPlan)
{
Model.DriverSub_DriverSubPlan newDriverSubPlan = new Model.DriverSub_DriverSubPlan();
newDriverSubPlan.DriverSubPlanId = DriverSubPlan.DriverSubPlanId;
newDriverSubPlan.ProjectId = DriverSubPlan.ProjectId;
newDriverSubPlan.Code = DriverSubPlan.Code;
newDriverSubPlan.SubUnitId = DriverSubPlan.SubUnitId;
newDriverSubPlan.Introductions = DriverSubPlan.Introductions;
newDriverSubPlan.Achievement = DriverSubPlan.Achievement;
newDriverSubPlan.Cooperation = DriverSubPlan.Cooperation;
newDriverSubPlan.InstallationIds = DriverSubPlan.InstallationIds;
newDriverSubPlan.InstallationNames = DriverSubPlan.InstallationNames;
newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited;
newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl;
newDriverSubPlan.Remark = DriverSubPlan.Remark;
Funs.DB.DriverSub_DriverSubPlan.InsertOnSubmit(newDriverSubPlan);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改开车分包计划
/// </summary>
/// <param name="DriverSubPlan"></param>
public static void UpdateDriverSubPlan(Model.DriverSub_DriverSubPlan DriverSubPlan)
{
Model.DriverSub_DriverSubPlan newDriverSubPlan = Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlan.DriverSubPlanId);
if (newDriverSubPlan != null)
{
newDriverSubPlan.Code = DriverSubPlan.Code;
newDriverSubPlan.SubUnitId = DriverSubPlan.SubUnitId;
newDriverSubPlan.Introductions = DriverSubPlan.Introductions;
newDriverSubPlan.Achievement = DriverSubPlan.Achievement;
newDriverSubPlan.Cooperation = DriverSubPlan.Cooperation;
newDriverSubPlan.InstallationIds = DriverSubPlan.InstallationIds;
newDriverSubPlan.InstallationNames = DriverSubPlan.InstallationNames;
newDriverSubPlan.IsInvited = DriverSubPlan.IsInvited;
newDriverSubPlan.AttachUrl = DriverSubPlan.AttachUrl;
newDriverSubPlan.Remark = DriverSubPlan.Remark;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除开车分包计划
/// </summary>
/// <param name="DriverSubPlanId"></param>
public static void DeleteDriverSubPlanById(string DriverSubPlanId)
{
Model.DriverSub_DriverSubPlan DriverSubPlan = Funs.DB.DriverSub_DriverSubPlan.FirstOrDefault(e => e.DriverSubPlanId == DriverSubPlanId);
if (DriverSubPlan != null)
{
if (!string.IsNullOrEmpty(DriverSubPlan.AttachUrl))
{
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, DriverSubPlan.AttachUrl);//删除附件
}
Funs.DB.DriverSub_DriverSubPlan.DeleteOnSubmit(DriverSubPlan);
Funs.DB.SubmitChanges();
}
}
}
}