using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Web.UI.WebControls; namespace BLL { /// /// 焊接方法 /// public static class HJGL_WeldingMethodService { /// /// 根据焊接方法Id获取焊接方法信息 /// /// /// public static Model.HJGL_BS_WeldMethod GetWeldMethodByWMEID(string wme_id) { return Funs.DB.HJGL_BS_WeldMethod.FirstOrDefault(e => e.WME_ID == wme_id); } /// /// 增加 /// /// public static void AddWeldMethod(Model.HJGL_BS_WeldMethod weldMethod) { Model.SGGLDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_WeldMethod)); Model.HJGL_BS_WeldMethod newWeldMethod = new Model.HJGL_BS_WeldMethod(); newWeldMethod.WME_ID = newKeyID; newWeldMethod.WME_Code = weldMethod.WME_Code; newWeldMethod.WME_Name = weldMethod.WME_Name; newWeldMethod.WME_Remark = weldMethod.WME_Remark; db.HJGL_BS_WeldMethod.InsertOnSubmit(newWeldMethod); db.SubmitChanges(); } /// /// 修改 /// /// public static void UpdateWeldMethod(Model.HJGL_BS_WeldMethod weldMethod) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_WeldMethod newWeldMethod = db.HJGL_BS_WeldMethod.FirstOrDefault(e => e.WME_ID == weldMethod.WME_ID); if (newWeldMethod != null) { newWeldMethod.WME_Code = weldMethod.WME_Code; newWeldMethod.WME_Name = weldMethod.WME_Name; newWeldMethod.WME_Remark = weldMethod.WME_Remark; db.SubmitChanges(); } } /// /// 删除焊接方法 /// /// public static void DeleteWeldMethod(string wme_id) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_WeldMethod weldMethod = db.HJGL_BS_WeldMethod.FirstOrDefault(e => e.WME_ID == wme_id); if (weldMethod != null) { db.HJGL_BS_WeldMethod.DeleteOnSubmit(weldMethod); db.SubmitChanges(); } } /// /// 判断是否存在相同的焊接方法代码 /// /// /// public static bool IsExitWMECode(string wme_code,string id ) { var q = Funs.DB.HJGL_BS_WeldMethod.FirstOrDefault(x => x.WME_Code == wme_code && x.WME_ID != id); if (q != null) { return true; } else { return false; } } /// /// 获取焊接方法 /// /// public static List GetWeldMethodNameList() { var q = (from x in Funs.DB.HJGL_BS_WeldMethod orderby x.WME_Code select x).ToList(); return q; } /// /// 根据焊接方法编号获取焊接方法信息 /// /// /// public static Model.HJGL_BS_WeldMethod GetMethodByMethodCode(string wmeCode) { return Funs.DB.HJGL_BS_WeldMethod.FirstOrDefault(x => x.WME_Code == wmeCode); } } }