SGGL_SHJ/SGGL/BLL/CQMS/Material/CQMS_ConstructionTestServic...

79 lines
3.9 KiB
C#

using System.Linq;
namespace BLL
{
public class CQMS_ConstructionTestService
{
/// <summary>
/// 获取施工试验信息
/// </summary>
/// <param name="UnitWorkId"></param>
/// <returns></returns>
public static Model.Material_ConstructionTest GetConstructionTestByConstructionTestId(string ConstructionTestId)
{
return Funs.DB.Material_ConstructionTest.FirstOrDefault(e => e.ConstructionTestId == ConstructionTestId);
}
/// <summary>
/// 添加施工试验信息
/// </summary>
/// <param name="WPQ"></param>
public static void AddConstructionTest(Model.Material_ConstructionTest ConstructionTest)
{
Model.SGGLDB db = Funs.DB;
Model.Material_ConstructionTest newConstructionTest = new Model.Material_ConstructionTest();
newConstructionTest.ConstructionTestId = ConstructionTest.ConstructionTestId;
newConstructionTest.ProjectId = ConstructionTest.ProjectId;
newConstructionTest.UnitId = ConstructionTest.UnitId;
newConstructionTest.ConstructionTestName = ConstructionTest.ConstructionTestName;
newConstructionTest.ConstructionTestTypeId = ConstructionTest.ConstructionTestTypeId;
newConstructionTest.SpotCheckRate = ConstructionTest.SpotCheckRate;
newConstructionTest.SpotCheckNum = ConstructionTest.SpotCheckNum;
newConstructionTest.Witness = ConstructionTest.Witness;
newConstructionTest.CheckResult = ConstructionTest.CheckResult;
newConstructionTest.CheckUnit = ConstructionTest.CheckUnit;
newConstructionTest.CompileMan = ConstructionTest.CompileMan;
newConstructionTest.CompileDate = ConstructionTest.CompileDate;
db.Material_ConstructionTest.InsertOnSubmit(newConstructionTest);
db.SubmitChanges();
}
/// <summary>
/// 修改施工试验信息
/// </summary>
/// <param name="WPQ"></param>
public static void UpdateConstructionTest(Model.Material_ConstructionTest ConstructionTest)
{
Model.SGGLDB db = Funs.DB;
Model.Material_ConstructionTest newConstructionTest = db.Material_ConstructionTest.FirstOrDefault(e => e.ConstructionTestId == ConstructionTest.ConstructionTestId);
if (newConstructionTest != null)
{
newConstructionTest.UnitId = ConstructionTest.UnitId;
newConstructionTest.ConstructionTestName = ConstructionTest.ConstructionTestName;
newConstructionTest.ConstructionTestTypeId = ConstructionTest.ConstructionTestTypeId;
newConstructionTest.SpotCheckRate = ConstructionTest.SpotCheckRate;
newConstructionTest.SpotCheckNum = ConstructionTest.SpotCheckNum;
newConstructionTest.Witness = ConstructionTest.Witness;
newConstructionTest.CheckResult = ConstructionTest.CheckResult;
newConstructionTest.CheckUnit = ConstructionTest.CheckUnit;
newConstructionTest.CompileMan = ConstructionTest.CompileMan;
newConstructionTest.CompileDate = ConstructionTest.CompileDate;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除施工试验信息
/// </summary>
/// <param name="checkerId"></param>
public static void DeleteConstructionTestById(string ConstructionTestId)
{
Model.SGGLDB db = Funs.DB;
Model.Material_ConstructionTest ConstructionTest = db.Material_ConstructionTest.FirstOrDefault(e => e.ConstructionTestId == ConstructionTestId);
if (ConstructionTest != null)
{
db.Material_ConstructionTest.DeleteOnSubmit(ConstructionTest);
db.SubmitChanges();
}
}
}
}