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_ConsumablesService { /// /// 根据焊接耗材ID获取区域信息 /// /// /// public static Model.HJGL_BS_WeldMaterial getConsumablesByConsumablesId(string ConsumablesId) { return Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == ConsumablesId); } /// /// 根据焊接耗材Code获取区域信息 /// /// /// public static bool IsExistConsumablesCode(string consumablesCode, string consumablesId) { var q = Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(x => x.WMT_MatCode == consumablesCode && x.WMT_ID != consumablesId); if (q != null) { return true; } else { return false; } } /// /// 添加焊接耗材 /// /// public static void AddConsumables(Model.HJGL_BS_WeldMaterial Consumables) { Model.SGGLDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_WeldMaterial)); Model.HJGL_BS_WeldMaterial newConsumables = new Model.HJGL_BS_WeldMaterial(); newConsumables.WMT_ID = newKeyID; newConsumables.WMT_MatCode = Consumables.WMT_MatCode; newConsumables.WMT_MatName = Consumables.WMT_MatName; newConsumables.WMT_MatType = Consumables.WMT_MatType; newConsumables.WMT_Remark = Consumables.WMT_Remark; db.HJGL_BS_WeldMaterial.InsertOnSubmit(newConsumables); db.SubmitChanges(); } /// /// 修改焊接耗材 /// /// public static void updateConsumables(Model.HJGL_BS_WeldMaterial Consumables) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_WeldMaterial newConsumables = db.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == Consumables.WMT_ID); if (newConsumables != null) { newConsumables.WMT_MatCode = Consumables.WMT_MatCode; newConsumables.WMT_MatName = Consumables.WMT_MatName; newConsumables.WMT_MatType = Consumables.WMT_MatType; newConsumables.WMT_Remark = Consumables.WMT_Remark; newConsumables.WMT_Remark = Consumables.WMT_Remark; db.SubmitChanges(); } } /// /// 根据焊接耗材Id删除一个焊接耗材信息 /// /// public static void DeleteConsumables(string ConsumablesId) { Model.SGGLDB db = Funs.DB; Model.HJGL_BS_WeldMaterial Consumables = db.HJGL_BS_WeldMaterial.FirstOrDefault(e => e.WMT_ID == ConsumablesId); if (Consumables != null) { db.HJGL_BS_WeldMaterial.DeleteOnSubmit(Consumables); db.SubmitChanges(); } } /// /// 根据焊接耗材代码获取焊接耗材信息 /// /// /// public static Model.HJGL_BS_WeldMaterial GetMaterialByMaterialCode(string materialCode) { return Funs.DB.HJGL_BS_WeldMaterial.FirstOrDefault(x => x.WMT_MatCode == materialCode); } /// /// 获取材料信息名称 /// /// public static List GetMaterialList(string type) { var q = (from x in Funs.DB.HJGL_BS_WeldMaterial where (type != null && x.WMT_MatType == type) orderby x.WMT_MatCode select x).ToList(); return q; } ///// ///// 获取焊丝代号 ///// ///// //public static List GetMaterialSilkList() //{ // var q = (from x in Funs.DB.HJGL_BS_WeldMaterial where x.WMT_MatType=="1" orderby x.WMT_MatCode select x).ToList(); // return q; //} ///// ///// 获取焊条代号 ///// ///// //public static List GetMaterialWeldMatList() //{ // var q = (from x in Funs.DB.HJGL_BS_WeldMaterial where x.WMT_MatType == "2" orderby x.WMT_MatCode select x).ToList(); // return q; //} } }