SGGL_SHJ/SGGL/BLL/CQMS/PersonManage/CQMS_TestPlanService.cs

70 lines
2.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace BLL
{
public class CQMS_TestPlanService
{
/// <summary>
/// 获取焊工考试计划信息
/// </summary>
/// <param name="UnitWorkId"></param>
/// <returns></returns>
public static Model.Welder_TestPlan GetTestPlanByTestPlanId(string TestPlanId)
{
return Funs.DB.Welder_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlanId);
}
/// <summary>
/// 添加焊工考试计划信息
/// </summary>
/// <param name="WPQ"></param>
public static void AddTestPlan(Model.Welder_TestPlan TestPlan)
{
Model.SGGLDB db = Funs.DB;
Model.Welder_TestPlan newTestPlan = new Model.Welder_TestPlan();
newTestPlan.TestPlanId = TestPlan.TestPlanId;
newTestPlan.ProjectId = TestPlan.ProjectId;
newTestPlan.TestPlanCode = TestPlan.TestPlanCode;
newTestPlan.PlanTestDate = TestPlan.PlanTestDate;
newTestPlan.CompileMan = TestPlan.CompileMan;
newTestPlan.CompileDate = TestPlan.CompileDate;
db.Welder_TestPlan.InsertOnSubmit(newTestPlan);
db.SubmitChanges();
}
/// <summary>
/// 修改焊工考试计划信息
/// </summary>
/// <param name="WPQ"></param>
public static void UpdateTestPlan(Model.Welder_TestPlan TestPlan)
{
Model.SGGLDB db = Funs.DB;
Model.Welder_TestPlan newTestPlan = db.Welder_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlan.TestPlanId);
if (newTestPlan != null)
{
newTestPlan.TestPlanCode = TestPlan.TestPlanCode;
newTestPlan.PlanTestDate = TestPlan.PlanTestDate;
newTestPlan.RealTestDate = TestPlan.RealTestDate;
newTestPlan.CompileMan = TestPlan.CompileMan;
newTestPlan.CompileDate = TestPlan.CompileDate;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除焊工考试计划信息
/// </summary>
/// <param name="checkerId"></param>
public static void DeleteTestPlanById(string TestPlanId)
{
Model.SGGLDB db = Funs.DB;
Model.Welder_TestPlan TestPlan = db.Welder_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlanId);
if (TestPlan != null)
{
db.Welder_TestPlan.DeleteOnSubmit(TestPlan);
db.SubmitChanges();
}
}
}
}