namespace BLL
{
using Model;
using System.Collections.Generic;
using System.Linq;
public static class Base_TestStandardService
{
///
///获取检测标准信息
///
///
public static Model.Base_TestStandard GetTestStandardById(string testStandardId)
{
return Funs.DB.Base_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandardId);
}
///
/// 增加检测标准信息
///
///
public static void AddTestStandard(Model.Base_TestStandard testStandard)
{
Model.HJGLDB db = Funs.DB;
Model.Base_TestStandard newTestStandard = new Base_TestStandard
{
TestStandardId = testStandard.TestStandardId,
TestStandardName = testStandard.TestStandardName,
Remark = testStandard.Remark,
};
db.Base_TestStandard.InsertOnSubmit(newTestStandard);
db.SubmitChanges();
}
///
/// 修改检测标准信息
///
///
public static void UpdateTestStandard(Model.Base_TestStandard testStandard)
{
Model.HJGLDB db = Funs.DB;
Model.Base_TestStandard newTestStandard = db.Base_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandard.TestStandardId);
if (newTestStandard != null)
{
newTestStandard.TestStandardId = testStandard.TestStandardId;
newTestStandard.TestStandardName = testStandard.TestStandardName;
newTestStandard.Remark = testStandard.Remark;
db.SubmitChanges();
}
}
///
/// 根据检测标准Id删除一个检测标准信息
///
///
public static void DeleteTestStandardById(string testStandardId)
{
Model.HJGLDB db = Funs.DB;
Model.Base_TestStandard delTestStandard = db.Base_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandardId);
if (delTestStandard != null)
{
db.Base_TestStandard.DeleteOnSubmit(delTestStandard);
db.SubmitChanges();
}
}
///
/// 按类型获取检测标准项
///
///
///
public static List GetTestStandardList()
{
var list = (from x in Funs.DB.Base_TestStandard
orderby x.TestStandardName
select x).ToList();
return list;
}
#region 检测标准下拉项
///
/// 检测标准下拉项
///
/// 下拉框名称
/// 是否显示请选择
/// 项文本
public static void InitTestStandardDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease, string itemText)
{
dropName.DataValueField = "TestStandardId";
dropName.DataTextField = "TestStandardName";
dropName.DataSource = GetTestStandardList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName, itemText);
}
}
#endregion
}
}