using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
   public class WeldMethodItemService
    {
        /// 
        /// 根据人员Id和焊接方法Id判断是否在焊接方法明细中
        /// 
        /// 
        /// 
        /// 
        public static bool IsInBS_WeldMethodItem(string wenId, string wmeId)
        {
            bool isIn = false;
            var weldMethod = Funs.DB.BS_WeldMethodItem.FirstOrDefault(x => x.WED_ID == wenId && x.WME_ID == wmeId);
            if (weldMethod != null)
            {
                isIn = true;
            }
            return isIn;
        }
        /// 
        /// 根据焊接人员Id删除焊接方法明细
        /// 
        /// 
        public static void DeleteWeldMethodItem(string wenId)
        {
            var q = (from x in Funs.DB.BS_WeldMethodItem where x.WED_ID == wenId select x).ToList();
            Funs.DB.BS_WeldMethodItem.DeleteAllOnSubmit(q);
            Funs.DB.SubmitChanges();
        }
        /// 
        /// 添加焊接方法明细
        /// 
        /// 
        public static void AddWeldMethodItem(Model.BS_WeldMethodItem weldMethodItem)
        {
            Model.BS_WeldMethodItem newWeldMethodItem = new Model.BS_WeldMethodItem();
            newWeldMethodItem.WeldMethodItemId = weldMethodItem.WeldMethodItemId;
            newWeldMethodItem.WED_ID = weldMethodItem.WED_ID;
            newWeldMethodItem.WME_ID = weldMethodItem.WME_ID;
            Funs.DB.BS_WeldMethodItem.InsertOnSubmit(newWeldMethodItem);
            Funs.DB.SubmitChanges();
        }
        /// 
        /// 获取所有焊接方法信息
        /// 
        /// 
        public static List GetWeldMethodList()
        {
            return (from x in Funs.DB.Base_WeldingMethod orderby x.WeldingMethodCode select x).ToList();
        }
    }
}