using System.Collections.Generic; using System.Linq; namespace BLL { /// /// 焊接位置 /// public static class Base_WeldingLocationServie { /// /// 根据主键获取焊接位置信息 /// /// /// public static Model.Base_WeldingLocation GetWeldingLocationById(string weldingLocationId) { return Funs.DB.Base_WeldingLocation.FirstOrDefault(e => e.WeldingLocationId == weldingLocationId); } /// /// 增加焊接位置 /// /// public static void AddWeldingLocation(Model.Base_WeldingLocation weldingLocation) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingLocation newWeldingLocation = new Model.Base_WeldingLocation(); newWeldingLocation.WeldingLocationId = weldingLocation.WeldingLocationId; newWeldingLocation.WeldingLocationCode = weldingLocation.WeldingLocationCode; newWeldingLocation.Remark = weldingLocation.Remark; db.Base_WeldingLocation.InsertOnSubmit(weldingLocation); db.SubmitChanges(); } /// /// 修改焊接位置 /// /// public static void UpdateWeldingLocation(Model.Base_WeldingLocation weldingLocation) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingLocation newWeldingLocation = db.Base_WeldingLocation.FirstOrDefault(e => e.WeldingLocationId == weldingLocation.WeldingLocationId); if (newWeldingLocation != null) { newWeldingLocation.WeldingLocationCode = weldingLocation.WeldingLocationCode; newWeldingLocation.Remark = weldingLocation.Remark; db.SubmitChanges(); } } /// /// 根据主键删除焊接位置 /// /// public static void DeleteWeldingLocationById(string weldingLocationId) { Model.HJGLDB db = Funs.DB; Model.Base_WeldingLocation weldingLocation = db.Base_WeldingLocation.FirstOrDefault(e => e.WeldingLocationId == weldingLocationId); if (weldingLocation != null) { db.Base_WeldingLocation.DeleteOnSubmit(weldingLocation); db.SubmitChanges(); } } /// /// 获取焊接位置列表 /// /// public static List GetWeldingLocationList() { return (from x in Funs.DB.Base_WeldingLocation orderby x.WeldingLocationCode select x).ToList(); } /// /// 获取下拉列表选择项 /// /// /// /// public static void InitWeldingLocationDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease, string itemText) { dropName.DataValueField = "WeldingLocationId"; dropName.DataTextField = "WeldingLocationCode"; dropName.DataSource = GetWeldingLocationList(); dropName.DataBind(); if (isShowPlease) { Funs.FineUIPleaseSelect(dropName, itemText); } } } }