using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace BLL
{
public class CQMS_TestPlanService
{
///
/// 获取焊工考试计划信息
///
///
///
public static Model.Welder_TestPlan GetTestPlanByTestPlanId(string TestPlanId)
{
return Funs.DB.Welder_TestPlan.FirstOrDefault(e => e.TestPlanId == TestPlanId);
}
///
/// 添加焊工考试计划信息
///
///
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();
}
///
/// 修改焊工考试计划信息
///
///
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();
}
}
///
/// 根据主键删除焊工考试计划信息
///
///
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();
}
}
}
}