114 lines
4.1 KiB
C#
114 lines
4.1 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_TestStandardService
|
|
{
|
|
/// <summary>
|
|
/// 根据检测标准ID获取检测标准信息
|
|
/// </summary>
|
|
/// <param name="testStandardId"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_TestStandard GetTestStandardByTestStandardId(string testStandardId)
|
|
{
|
|
return Funs.DB.HJGL_BS_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandardId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加检测标准
|
|
/// </summary>
|
|
/// <param name="testStandard"></param>
|
|
public static void AddTestStandard(Model.HJGL_BS_TestStandard testStandard)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_TestStandard newTestStandard = new Model.HJGL_BS_TestStandard();
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_TestStandard));
|
|
|
|
newTestStandard.TestStandardId = newKeyID;
|
|
newTestStandard.TestStandardCode = testStandard.TestStandardCode;
|
|
newTestStandard.TestStandardName = testStandard.TestStandardName;
|
|
newTestStandard.Remark = testStandard.Remark;
|
|
db.HJGL_BS_TestStandard.InsertOnSubmit(newTestStandard);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改检测标准
|
|
/// </summary>
|
|
/// <param name="testStandard"></param>
|
|
public static void UpdateTestStandard(Model.HJGL_BS_TestStandard testStandard)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_TestStandard newTestStandard = db.HJGL_BS_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandard.TestStandardId);
|
|
if (newTestStandard != null)
|
|
{
|
|
newTestStandard.TestStandardCode = testStandard.TestStandardCode;
|
|
newTestStandard.TestStandardName = testStandard.TestStandardName;
|
|
newTestStandard.Remark = testStandard.Remark;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除检测标准
|
|
/// </summary>
|
|
/// <param name="testStandardId"></param>
|
|
public static void DeleteTestStandard(string testStandardId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_TestStandard testStandard = db.HJGL_BS_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandardId);
|
|
if (testStandard != null)
|
|
{
|
|
db.HJGL_BS_TestStandard.DeleteOnSubmit(testStandard);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的检测标准代号
|
|
/// </summary>
|
|
/// <param name="testStandardCode"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitTestStandardCode(string testStandardCode, string id)
|
|
{
|
|
var q = Funs.DB.HJGL_BS_TestStandard.FirstOrDefault(x => x.TestStandardCode == testStandardCode && x.TestStandardId != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取检测标准名称
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_TestStandard> GetTestStandardNameList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_TestStandard orderby x.TestStandardCode select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检测标准代码获取检测标准代号信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_TestStandard GetTestStandardByTestStandardCode(string testStandardCode)
|
|
{
|
|
return Funs.DB.HJGL_BS_TestStandard.FirstOrDefault(x => x.TestStandardCode == testStandardCode);
|
|
}
|
|
}
|
|
}
|