using Model;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public static class Base_GasProtectionModeService
{
///
///获取气体保护方式信息
///
///
public static Model.Base_GasProtectionMode GetGasProtectionModeByGasProtectionModeId(string gasProtectionModeId)
{
return Funs.DB.Base_GasProtectionMode.FirstOrDefault(e => e.GasProtectionModeId == gasProtectionModeId);
}
///
/// 增加气体保护方式信息
///
///
public static void AddGasProtectionMode(Model.Base_GasProtectionMode gasProtectionMode)
{
Model.SGGLDB db = Funs.DB;
Model.Base_GasProtectionMode newGasProtectionMode = new Base_GasProtectionMode
{
GasProtectionModeId = gasProtectionMode.GasProtectionModeId,
GasProtectionModeName = gasProtectionMode.GasProtectionModeName,
Remark = gasProtectionMode.Remark,
};
db.Base_GasProtectionMode.InsertOnSubmit(newGasProtectionMode);
db.SubmitChanges();
}
///
/// 修改气体保护方式信息
///
///
public static void UpdateGasProtectionMode(Model.Base_GasProtectionMode gasProtectionMode)
{
Model.SGGLDB db = Funs.DB;
Model.Base_GasProtectionMode newGasProtectionMode = db.Base_GasProtectionMode.FirstOrDefault(e => e.GasProtectionModeId == gasProtectionMode.GasProtectionModeId);
if (newGasProtectionMode != null)
{
newGasProtectionMode.GasProtectionModeName = gasProtectionMode.GasProtectionModeName;
newGasProtectionMode.Remark = gasProtectionMode.Remark;
db.SubmitChanges();
}
}
///
/// 根据气体保护方式Id删除一个气体保护方式信息
///
///
public static void DeleteGasProtectionModeByGasProtectionModeId(string gasProtectionModeId)
{
Model.SGGLDB db = Funs.DB;
Model.Base_GasProtectionMode delGasProtectionMode = db.Base_GasProtectionMode.FirstOrDefault(e => e.GasProtectionModeId == gasProtectionModeId);
if (delGasProtectionMode != null)
{
db.Base_GasProtectionMode.DeleteOnSubmit(delGasProtectionMode);
db.SubmitChanges();
}
}
///
/// 按类型获取气体保护方式项
///
///
///
public static List GetGasProtectionModeListByGasProtectionModeType()
{
var list = (from x in Funs.DB.Base_GasProtectionMode
orderby x.GasProtectionModeName
select x).ToList();
return list;
}
#region 气体保护方式下拉项
///
/// 气体保护方式下拉项
///
/// 下拉框名称
/// 是否显示请选择
/// 耗材类型
public static void InitGasProtectionModeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease, string itemText)
{
dropName.DataValueField = "GasProtectionModeId";
dropName.DataTextField = "GasProtectionModeName";
dropName.DataSource = GetGasProtectionModeListByGasProtectionModeType();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName, itemText);
}
}
#endregion
}
}