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_WeldService { /// /// 根据焊缝类型Id获取焊缝类型信息 /// /// /// public static Model.HJGL_BS_JointType GetJointTypeByID(string joty_id) { return Funs.DB.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == joty_id); } /// /// 添加焊缝类型 /// /// public static void AddJointType(Model.HJGL_BS_JointType jointType) { Model.SGGLDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_JointType)); Model.HJGL_BS_JointType newJointType = new Model.HJGL_BS_JointType(); newJointType.JOTY_ID = newKeyID; newJointType.JOTY_Code = jointType.JOTY_Code; newJointType.JOTY_Name = jointType.JOTY_Name; newJointType.JOTY_Remark = jointType.JOTY_Remark; newJointType.JOTY_Group = jointType.JOTY_Group; db.HJGL_BS_JointType.InsertOnSubmit(newJointType); db.SubmitChanges(); } /// /// 修改焊缝类型 /// /// public static void UpdateJointType(Model.HJGL_BS_JointType jointType) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_JointType newJointType = db.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == jointType.JOTY_ID); if (newJointType != null) { newJointType.JOTY_Code = jointType.JOTY_Code; newJointType.JOTY_Name = jointType.JOTY_Name; newJointType.JOTY_Remark = jointType.JOTY_Remark; newJointType.JOTY_Group = jointType.JOTY_Group; db.SubmitChanges(); } } /// /// 删除焊缝类型 /// /// public static void DeleteJointType(string jot_id) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_JointType jointType = db.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == jot_id); if (jointType != null) { db.HJGL_BS_JointType.DeleteOnSubmit(jointType); db.SubmitChanges(); } } /// /// 判断是否存在相同的焊缝类型编号 /// /// /// public static bool IsExitJotyCode(string joty_code, string id, string projectSoft) { var q = Funs.DB.HJGL_BS_JointType.FirstOrDefault(x => x.JOTY_Code == joty_code && x.JOTY_ID != id && x.ProjectSoft == projectSoft); return q != null ? true : false; } /// /// 获取焊缝类型名称 /// /// public static List GetJointTypeNameList(string projectSoft) { var q = (from x in Funs.DB.HJGL_BS_JointType where x.ProjectSoft == projectSoft orderby x.JOTY_Code select x).ToList(); return q; } /// /// 根据焊缝类型获取焊缝类型信息 /// /// /// public static Model.HJGL_BS_JointType GetJointTypeByJointTypeName(string jointTypeName) { return Funs.DB.HJGL_BS_JointType.FirstOrDefault(x => x.JOTY_Name == jointTypeName); } } }