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_ComponentsService { /// /// 根据安装组件ID获取安装组件信息 /// /// /// public static Model.HJGL_BS_Component GetComponentByComID(string com_id) { return Funs.DB.HJGL_BS_Component.FirstOrDefault(e => e.COM_ID == com_id); } /// /// 添加安装组件 /// /// public static void AddComponent(Model.HJGL_BS_Component component) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_Component newComponent = new Model.HJGL_BS_Component(); string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_Component)); newComponent.COM_ID = newKeyID; newComponent.COM_Code = component.COM_Code; newComponent.COM_Name = component.COM_Name; newComponent.COM_Remark = component.COM_Remark; db.HJGL_BS_Component.InsertOnSubmit(newComponent); db.SubmitChanges(); } /// /// 修改安装组件 /// /// public static void UpdateComponent(Model.HJGL_BS_Component component) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_Component newComponent = db.HJGL_BS_Component.FirstOrDefault(e => e.COM_ID == component.COM_ID); if (newComponent != null) { newComponent.COM_Code = component.COM_Code; newComponent.COM_Name = component.COM_Name; newComponent.COM_Remark = component.COM_Remark; db.SubmitChanges(); } } /// /// 删除安装组件 /// /// public static void DeleteComponent(string com_id) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_Component component = db.HJGL_BS_Component.FirstOrDefault(e => e.COM_ID == com_id); if (component != null) { db.HJGL_BS_Component.DeleteOnSubmit(component); db.SubmitChanges(); } } /// /// 判断是否存在相同的组件代号 /// /// /// public static bool IsExitComCode(string com_code, string id) { var q = Funs.DB.HJGL_BS_Component.FirstOrDefault(x => x.COM_Code == com_code && x.COM_ID != id); if (q != null) { return true; } else { return false; } } /// /// 获取焊缝类型名称 /// /// public static List GetComponentNameList() { var q = (from x in Funs.DB.HJGL_BS_Component orderby x.COM_Code select x).ToList(); return q; } /// /// 组件代码获取组件代号信息 /// /// /// public static Model.HJGL_BS_Component GetComponentByComponentCode(string componentCode) { return Funs.DB.HJGL_BS_Component.FirstOrDefault(x => x.COM_Code == componentCode); } } }