103 lines
3.6 KiB
C#
103 lines
3.6 KiB
C#
namespace BLL
|
|
{
|
|
using Model;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public static class Base_TestStandardService
|
|
{
|
|
/// <summary>
|
|
///获取检测标准信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static Model.Base_TestStandard GetTestStandardById(string testStandardId)
|
|
{
|
|
return Funs.DB.Base_TestStandard.FirstOrDefault(e => e.TestStandardId == testStandardId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加检测标准信息
|
|
/// </summary>
|
|
/// <param name="grooveType"></param>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改检测标准信息
|
|
/// </summary>
|
|
/// <param name="grooveType"></param>
|
|
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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据检测标准Id删除一个检测标准信息
|
|
/// </summary>
|
|
/// <param name="grooveTypeId"></param>
|
|
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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按类型获取检测标准项
|
|
/// </summary>
|
|
/// <param name="GrooveTypeType"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.Base_TestStandard> GetTestStandardList()
|
|
{
|
|
var list = (from x in Funs.DB.Base_TestStandard
|
|
orderby x.TestStandardName
|
|
select x).ToList();
|
|
|
|
return list;
|
|
}
|
|
|
|
#region 检测标准下拉项
|
|
/// <summary>
|
|
/// 检测标准下拉项
|
|
/// </summary>
|
|
/// <param name="dropName">下拉框名称</param>
|
|
/// <param name="isShowPlease">是否显示请选择</param>
|
|
/// <param name="itemText">项文本</param>
|
|
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
|
|
}
|
|
}
|