namespace BLL { using Model; using System.Collections.Generic; using System.Linq; public static class Base_WeldingMethodService { /// ///获取焊接方法信息 /// /// public static Model.Base_WeldingMethod GetWeldingMethodByWeldingMethodId(string weldingMethodId) { return Funs.DB.Base_WeldingMethod.FirstOrDefault(e => e.WeldingMethodId == weldingMethodId); } /// /// 增加焊接方法信息 /// /// public static void AddWeldingMethod(Model.Base_WeldingMethod weldingMethod) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingMethod newWeldingMethod = new Base_WeldingMethod { WeldingMethodId = weldingMethod.WeldingMethodId, WeldingMethodCode = weldingMethod.WeldingMethodCode, WeldingMethodName = weldingMethod.WeldingMethodName, Remark = weldingMethod.Remark, ConsumablesType=weldingMethod.ConsumablesType, }; db.Base_WeldingMethod.InsertOnSubmit(newWeldingMethod); db.SubmitChanges(); } /// /// 修改焊接方法信息 /// /// public static void UpdateWeldingMethod(Model.Base_WeldingMethod weldingMethod) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingMethod newWeldingMethod = db.Base_WeldingMethod.FirstOrDefault(e => e.WeldingMethodId == weldingMethod.WeldingMethodId); if (newWeldingMethod != null) { newWeldingMethod.WeldingMethodCode = weldingMethod.WeldingMethodCode; newWeldingMethod.WeldingMethodName = weldingMethod.WeldingMethodName; newWeldingMethod.Remark = weldingMethod.Remark; newWeldingMethod.ConsumablesType = weldingMethod.ConsumablesType; db.SubmitChanges(); } } /// /// 根据焊接方法Id删除一个焊接方法信息 /// /// public static void DeleteWeldingMethodByWeldingMethodId(string weldingMethodId) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingMethod delWeldingMethod = db.Base_WeldingMethod.FirstOrDefault(e => e.WeldingMethodId == weldingMethodId); if (delWeldingMethod != null) { db.Base_WeldingMethod.DeleteOnSubmit(delWeldingMethod); db.SubmitChanges(); } } /// /// 按类型获取焊接方法项 /// /// /// public static List GetWeldingMethodList() { var list = (from x in Funs.DB.Base_WeldingMethod orderby x.WeldingMethodCode select x).ToList(); return list; } #region 焊接方法下拉项 /// /// 焊接方法下拉项 /// /// 下拉框名称 /// 是否显示请选择 /// 耗材类型 public static void InitWeldingMethodDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease,string itemText) { dropName.DataValueField = "WeldingMethodId"; dropName.DataTextField = "WeldingMethodCode"; dropName.DataSource = GetWeldingMethodList(); dropName.DataBind(); if (isShowPlease) { Funs.FineUIPleaseSelect(dropName,itemText); } } #endregion } }