using Model; using System.Linq; namespace BLL { /// /// 阀门试验确认表 /// public class ValveTestConfirmationFormService { /// /// 根据主键获取阀门试验确认表 /// /// /// public static Model.JGZL_ValveTestConfirmationForm GetValveTestConfirmationFormById(string Id) { return Funs.DB.JGZL_ValveTestConfirmationForm.FirstOrDefault(e => e.RecordId == Id); } /// /// 添加阀门试验确认表 /// /// 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(); } /// /// 修改阀门试验确认表 /// /// 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(); } } /// /// 根据主键删除阀门试验确认表 /// /// 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(); } } /// /// 根据项目Id删除阀门试验确认表 /// /// 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(); } } } }