CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/TestRun/DriverPrepare/DriverPrepareSchemePlanServ...

90 lines
3.8 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 DriverPrepareSchemePlanService
{
/// <summary>
/// 增加--开车资料收集
/// </summary>
public static void AddDriverPrepareDriverPlan(Model.DriverPrepare_SchemePlan DriverPrepareDriverPlan)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_SchemePlan newDriverData = new Model.DriverPrepare_SchemePlan();
newDriverData.SchemePlanId = DriverPrepareDriverPlan.SchemePlanId;
newDriverData.ProjectId = DriverPrepareDriverPlan.ProjectId;
newDriverData.SchemePlanName = DriverPrepareDriverPlan.SchemePlanName;
newDriverData.SchemePlanCode = DriverPrepareDriverPlan.SchemePlanCode;
newDriverData.CompileMan = DriverPrepareDriverPlan.CompileMan;
newDriverData.CompileDate = DriverPrepareDriverPlan.CompileDate;
newDriverData.AttachUrl = DriverPrepareDriverPlan.AttachUrl;
newDriverData.Remark = DriverPrepareDriverPlan.Remark;
db.DriverPrepare_SchemePlan.InsertOnSubmit(newDriverData);
db.SubmitChanges();
}
}
/// <summary>
/// 修改--开车资料收集
/// </summary>
public static void UpdateDriverPrepareDriverPlan(Model.DriverPrepare_SchemePlan DriverPrepareDriverPlan)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_SchemePlan newDriverData = db.DriverPrepare_SchemePlan.FirstOrDefault(e => e.SchemePlanId == DriverPrepareDriverPlan.SchemePlanId);
if (newDriverData != null)
{
newDriverData.ProjectId = DriverPrepareDriverPlan.ProjectId;
newDriverData.SchemePlanName = DriverPrepareDriverPlan.SchemePlanName;
newDriverData.SchemePlanCode = DriverPrepareDriverPlan.SchemePlanCode;
newDriverData.CompileMan = DriverPrepareDriverPlan.CompileMan;
newDriverData.CompileDate = DriverPrepareDriverPlan.CompileDate;
newDriverData.AttachUrl = DriverPrepareDriverPlan.AttachUrl;
newDriverData.Remark = DriverPrepareDriverPlan.Remark;
}
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除 开车资料收集
/// </summary>
/// <param name="DriverDataId"></param>
public static void DeleteDriverPlan(string SchemePlanId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.DriverPrepare_SchemePlan newDriverData = db.DriverPrepare_SchemePlan.FirstOrDefault(e => e.SchemePlanId == SchemePlanId);
if (newDriverData != null)
{
db.DriverPrepare_SchemePlan.DeleteOnSubmit(newDriverData);
db.SubmitChanges();
}
}
}
/// <summary>
/// 详情--开车资料收集
/// </summary>
public static Model.DriverPrepare_SchemePlan GetDriverPlanById(string SchemePlanId)
{
return Funs.DB.DriverPrepare_SchemePlan.FirstOrDefault(e => e.SchemePlanId == SchemePlanId);
}
/// <summary>
/// 详情--开车资料收集
/// </summary>
public static Model.DriverPrepare_SchemePlan GetDriverPlanByProjectId(string projectId)
{
return Funs.DB.DriverPrepare_SchemePlan.FirstOrDefault(e => e.ProjectId == projectId);
}
}
}