ChengDa_English/SGGL/BLL/TestRun/DriverPrepare/DriverPrepareDutyService.cs

82 lines
3.3 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class DriverPrepareDutyService
{
/// <summary>
/// 增加--开车资料收集
/// </summary>
public static void AddDriverPrepareDriverPlan(Model.DriverPrepare_Duty DriverPrepareDriverPlan)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_Duty newDriverData = new Model.DriverPrepare_Duty();
newDriverData.DutyId = DriverPrepareDriverPlan.DutyId;
newDriverData.ProjectId = DriverPrepareDriverPlan.ProjectId;
newDriverData.DutyName = DriverPrepareDriverPlan.DutyName;
newDriverData.DutyCode = DriverPrepareDriverPlan.DutyCode;
newDriverData.CompileMan = DriverPrepareDriverPlan.CompileMan;
newDriverData.CompileDate = DriverPrepareDriverPlan.CompileDate;
newDriverData.AttchUrl = DriverPrepareDriverPlan.AttchUrl;
newDriverData.Remark = DriverPrepareDriverPlan.Remark;
db.DriverPrepare_Duty.InsertOnSubmit(newDriverData);
db.SubmitChanges();
}
}
/// <summary>
/// 修改--开车资料收集
/// </summary>
public static void UpdateDriverPrepareDriverPlan(Model.DriverPrepare_Duty DriverPrepareDriverPlan)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_Duty newDriverData = db.DriverPrepare_Duty.FirstOrDefault(e => e.DutyId == DriverPrepareDriverPlan.DutyId);
if (newDriverData != null)
{
newDriverData.ProjectId = DriverPrepareDriverPlan.ProjectId;
newDriverData.DutyName = DriverPrepareDriverPlan.DutyName;
newDriverData.DutyCode = DriverPrepareDriverPlan.DutyCode;
newDriverData.CompileMan = DriverPrepareDriverPlan.CompileMan;
newDriverData.CompileDate = DriverPrepareDriverPlan.CompileDate;
newDriverData.AttchUrl = DriverPrepareDriverPlan.AttchUrl;
newDriverData.Remark = DriverPrepareDriverPlan.Remark;
}
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除 开车资料收集
/// </summary>
/// <param name="DriverDataId"></param>
public static void DeleteDriverPlan(string DutyId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_Duty newDriverData = db.DriverPrepare_Duty.FirstOrDefault(e => e.DutyId == DutyId);
if (newDriverData != null)
{
db.DriverPrepare_Duty.DeleteOnSubmit(newDriverData);
db.SubmitChanges();
}
}
}
/// <summary>
/// 详情--开车资料收集
/// </summary>
public static Model.DriverPrepare_Duty GetDriverPlanById(string DutyId)
{
return Funs.DB.DriverPrepare_Duty.FirstOrDefault(e => e.DutyId == DutyId);
}
}
}