116 lines
4.0 KiB
C#
116 lines
4.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 探伤类型
|
|
/// </summary>
|
|
public static class HJGL_TestingService
|
|
{
|
|
/// <summary>
|
|
/// 根据探伤类型Id获取探伤类型
|
|
/// </summary>
|
|
/// <param name="dnt_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_NDTType GetTestingByTestingId(string dnt_id)
|
|
{
|
|
return Funs.DB.HJGL_BS_NDTType.FirstOrDefault(e => e.NDT_ID == dnt_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加探伤类型
|
|
/// </summary>
|
|
/// <param name="testing"></param>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改探伤类型
|
|
/// </summary>
|
|
/// <param name="testing"></param>
|
|
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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除探伤类型
|
|
/// </summary>
|
|
/// <param name="testingId"></param>
|
|
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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的探伤类型代号
|
|
/// </summary>
|
|
/// <param name="testingCode"></param>
|
|
/// <returns></returns>
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取探伤类型下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_NDTType> GetNDTTypeNameList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_NDTType orderby x.NDT_Code select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取非RT探伤类型下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_NDTType> 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;
|
|
}
|
|
}
|
|
}
|