ChengDa_English/SGGL/BLL/HJGL/PersonManage/WeldMethodItemService.cs

65 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class WeldMethodItemService
{
/// <summary>
/// 根据人员Id和焊接方法Id判断是否在焊接方法明细中
/// </summary>
/// <param name="wenId"></param>
/// <param name="wmeId"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 根据焊接人员Id删除焊接方法明细
/// </summary>
/// <param name="wenId"></param>
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();
}
/// <summary>
/// 添加焊接方法明细
/// </summary>
/// <param name="weldMethodItem"></param>
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();
}
/// <summary>
/// 获取所有焊接方法信息
/// </summary>
/// <returns></returns>
public static List<Model.Base_WeldingMethod> GetWeldMethodList()
{
return (from x in Funs.DB.Base_WeldingMethod orderby x.WeldingMethodCode select x).ToList();
}
}
}