HJGL_DS/HJGL_DS/BLL/JGZL/ValveTestConfirmationFormSe...

106 lines
4.0 KiB
C#
Raw Normal View History

using Model;
using System.Linq;
namespace BLL
{
/// <summary>
/// 阀门试验确认表
/// </summary>
public class ValveTestConfirmationFormService
{
/// <summary>
/// 根据主键获取阀门试验确认表
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static Model.JGZL_ValveTestConfirmationForm GetValveTestConfirmationFormById(string Id)
{
return Funs.DB.JGZL_ValveTestConfirmationForm.FirstOrDefault(e => e.RecordId == Id);
}
/// <summary>
/// 添加阀门试验确认表
/// </summary>
/// <param name="model"></param>
public static void AddValveTestConfirmationForm(Model.JGZL_ValveTestConfirmationForm model)
{
SGGLDB db = Funs.DB;
Model.JGZL_ValveTestConfirmationForm newModel = new JGZL_ValveTestConfirmationForm();
newModel.RecordId = model.RecordId;
newModel.ProjectId = model.ProjectId;
newModel.Code = model.Code;
newModel.Name = model.Name;
newModel.ModelNumber = model.ModelNumber;
newModel.Specifications = model.Specifications;
newModel.NominalPressure = model.NominalPressure;
newModel.Num = model.Num;
newModel.PressureTest = model.PressureTest;
newModel.SealTest = model.SealTest;
newModel.UpperSealTest = model.UpperSealTest;
newModel.TestResults = model.TestResults;
newModel.Remark = model.Remark;
newModel.CompileMan = model.CompileMan;
newModel.CompileDate = model.CompileDate;
newModel.Reviewer = model.Reviewer;
newModel.RevieweDate = model.RevieweDate;
db.JGZL_ValveTestConfirmationForm.InsertOnSubmit(newModel);
db.SubmitChanges();
}
/// <summary>
/// 修改阀门试验确认表
/// </summary>
/// <param name="model"></param>
public static void UpdateValveTestConfirmationForm(Model.JGZL_ValveTestConfirmationForm model)
{
SGGLDB db = Funs.DB;
Model.JGZL_ValveTestConfirmationForm newModel = db.JGZL_ValveTestConfirmationForm.FirstOrDefault(e => e.RecordId == model.RecordId);
if (newModel != null)
{
newModel.Code = model.Code;
newModel.Name = model.Name;
newModel.ModelNumber = model.ModelNumber;
newModel.Specifications = model.Specifications;
newModel.NominalPressure = model.NominalPressure;
newModel.Num = model.Num;
newModel.PressureTest = model.PressureTest;
newModel.SealTest = model.SealTest;
newModel.UpperSealTest = model.UpperSealTest;
newModel.TestResults = model.TestResults;
newModel.Remark = model.Remark;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除阀门试验确认表
/// </summary>
/// <param name="Id"></param>
public static void DeleteValveTestConfirmationFormById(string Id)
{
SGGLDB db = Funs.DB;
Model.JGZL_ValveTestConfirmationForm model = db.JGZL_ValveTestConfirmationForm.FirstOrDefault(e => e.RecordId == Id);
if (model != null)
{
db.JGZL_ValveTestConfirmationForm.DeleteOnSubmit(model);
db.SubmitChanges();
}
}
2026-03-12 15:07:40 +08:00
/// <summary>
/// 根据项目Id删除阀门试验确认表
/// </summary>
/// <param name="projectId"></param>
public static void DeleteListByProjectId(string projectId)
{
SGGLDB db = Funs.DB;
var q = (from x in db.JGZL_ValveTestConfirmationForm where x.ProjectId == projectId select x).ToList();
if (q.Count>0)
{
db.JGZL_ValveTestConfirmationForm.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}