using Model; using System.Collections.Generic; using System.Linq; namespace BLL { public static class Base_ProtectionGasService { /// ///获取保护气体信息 /// /// public static Model.Base_ProtectionGas GetProtectionGasByProtectionGasId(string protectionGasId) { return Funs.DB.Base_ProtectionGas.FirstOrDefault(e => e.ProtectionGasId == protectionGasId); } /// /// 增加保护气体信息 /// /// public static void AddProtectionGas(Model.Base_ProtectionGas protectionGas) { Model.SGGLDB db = Funs.DB; Model.Base_ProtectionGas newProtectionGas = new Base_ProtectionGas { ProtectionGasId = protectionGas.ProtectionGasId, ProtectionGasCode = protectionGas.ProtectionGasCode, ProtectionGasName = protectionGas.ProtectionGasName, Remark = protectionGas.Remark, }; db.Base_ProtectionGas.InsertOnSubmit(newProtectionGas); db.SubmitChanges(); } /// /// 修改保护气体信息 /// /// public static void UpdateProtectionGas(Model.Base_ProtectionGas protectionGas) { Model.SGGLDB db = Funs.DB; Model.Base_ProtectionGas newProtectionGas = db.Base_ProtectionGas.FirstOrDefault(e => e.ProtectionGasId == protectionGas.ProtectionGasId); if (newProtectionGas != null) { newProtectionGas.ProtectionGasCode = protectionGas.ProtectionGasCode; newProtectionGas.ProtectionGasName = protectionGas.ProtectionGasName; newProtectionGas.Remark = protectionGas.Remark; db.SubmitChanges(); } } /// /// 根据保护气体Id删除一个保护气体信息 /// /// public static void DeleteProtectionGasByProtectionGasId(string protectionGasId) { Model.SGGLDB db = Funs.DB; Model.Base_ProtectionGas delProtectionGas = db.Base_ProtectionGas.FirstOrDefault(e => e.ProtectionGasId == protectionGasId); if (delProtectionGas != null) { db.Base_ProtectionGas.DeleteOnSubmit(delProtectionGas); db.SubmitChanges(); } } /// /// 按类型获取保护气体项 /// /// /// public static List GetProtectionGasListByProtectionGasType() { var list = (from x in Funs.DB.Base_ProtectionGas orderby x.ProtectionGasName select x).ToList(); return list; } #region 保护气体下拉项 /// /// 保护气体下拉项 /// /// 下拉框名称 /// 是否显示请选择 /// 耗材类型 public static void InitProtectionGasDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease, string itemText) { dropName.DataValueField = "ProtectionGasId"; dropName.DataTextField = "ProtectionGasName"; dropName.DataSource = GetProtectionGasListByProtectionGasType(); dropName.DataBind(); if (isShowPlease) { Funs.FineUIPleaseSelect(dropName, itemText); } } #endregion } }