using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Web.UI.WebControls; namespace BLL { /// /// 探伤类型 /// public static class HJGL_TestingService { /// /// 根据探伤类型Id获取探伤类型 /// /// /// public static Model.HJGL_BS_NDTType GetTestingByTestingId(string dnt_id) { return Funs.DB.HJGL_BS_NDTType.FirstOrDefault(e => e.NDT_ID == dnt_id); } /// /// 添加探伤类型 /// /// public static void AddTesting(Model.HJGL_BS_NDTType testing) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_NDTType newTesting = new Model.HJGL_BS_NDTType(); string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_NDTType)); newTesting.NDT_ID = newKeyID; newTesting.NDT_Code = testing.NDT_Code; newTesting.NDT_Name = testing.NDT_Name; newTesting.SysType = testing.SysType; newTesting.NDT_Description = testing.NDT_Description; newTesting.NDT_SecuritySpace = testing.NDT_SecuritySpace; newTesting.NDT_Harm = testing.NDT_Harm; newTesting.NDT_Remark = testing.NDT_Remark; db.HJGL_BS_NDTType.InsertOnSubmit(newTesting); db.SubmitChanges(); } /// /// 修改探伤类型 /// /// public static void UpdateTesting(Model.HJGL_BS_NDTType testing) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_NDTType newTesting = db.HJGL_BS_NDTType.FirstOrDefault(e => e.NDT_ID == testing.NDT_ID); if (newTesting != null) { newTesting.NDT_Code = testing.NDT_Code; newTesting.NDT_Name = testing.NDT_Name; newTesting.SysType = testing.SysType; newTesting.NDT_Description = testing.NDT_Description; newTesting.NDT_SecuritySpace = testing.NDT_SecuritySpace; newTesting.NDT_Harm = testing.NDT_Harm; newTesting.NDT_Remark = testing.NDT_Remark; db.SubmitChanges(); } } /// /// 删除探伤类型 /// /// public static void DeleteTesting(string testingId) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_NDTType testing = db.HJGL_BS_NDTType.FirstOrDefault(e => e.NDT_ID == testingId); if (testing != null) { db.HJGL_BS_NDTType.DeleteOnSubmit(testing); db.SubmitChanges(); } } /// /// 判断是否存在相同的探伤类型代号 /// /// /// public static bool IsExitTestingCode(string testingCode, string id, string projectSoft) { var q = Funs.DB.HJGL_BS_NDTType.FirstOrDefault(x => x.NDT_Code == testingCode && x.NDT_ID != id && x.ProjectSoft == projectSoft); return q != null ? true : false; } /// /// 获取探伤类型下拉框 /// /// public static List GetNDTTypeNameList() { var q = (from x in Funs.DB.HJGL_BS_NDTType orderby x.NDT_Code select x).ToList(); return q; } /// /// 获取非RT探伤类型下拉框 /// /// public static List GetNoRtNDTTypeNameList() { var q = (from x in Funs.DB.HJGL_BS_NDTType where x.NDT_Code.Trim() != "RT" orderby x.NDT_Code select x).ToList(); return q; } } }