using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
///
/// 硬度明细
///
public static class Hard_TrustItemService
{
///
/// 根据主键获取硬度明细
///
///
///
public static Model.Hard_TrustItem GetHardTrustItemById(string hardTrustItemId)
{
return Funs.DB.Hard_TrustItem.FirstOrDefault(e => e.HardTrustItemID == hardTrustItemId);
}
///
/// 根据硬度Id获取相关明细信息
///
///
///
public static List GetHardTrustItemByHardTrustId(string hardTrustId)
{
return (from x in Funs.DB.Hard_TrustItem where x.HardTrustID == hardTrustId select x).ToList();
}
///
/// 添加硬度明细
///
///
public static void AddHardTrustItem(Model.Hard_TrustItem hardTrustItem)
{
Model.HJGLDB db = Funs.DB;
Model.Hard_TrustItem newHardTrustItem = new Model.Hard_TrustItem();
newHardTrustItem.HardTrustItemID = SQLHelper.GetNewID(typeof(Model.Hard_TrustItem));
newHardTrustItem.HardTrustID = hardTrustItem.HardTrustID;
newHardTrustItem.HotProessTrustItemId = hardTrustItem.HotProessTrustItemId;
newHardTrustItem.WeldJointId = hardTrustItem.WeldJointId;
newHardTrustItem.IsPass = hardTrustItem.IsPass;
newHardTrustItem.IsTrust = hardTrustItem.IsTrust;
db.Hard_TrustItem.InsertOnSubmit(newHardTrustItem);
db.SubmitChanges();
}
///
/// 修改硬度
///
///
public static void UpdateHardTrustItem(Model.Hard_TrustItem hardTrustItem)
{
Model.HJGLDB db = Funs.DB;
Model.Hard_TrustItem newHardTrustItem = db.Hard_TrustItem.FirstOrDefault(e => e.HardTrustItemID == hardTrustItem.HardTrustItemID);
if (newHardTrustItem != null)
{
newHardTrustItem.IsPass = hardTrustItem.IsPass;
newHardTrustItem.IsTrust = hardTrustItem.IsTrust;
newHardTrustItem.HardTrustItemID = hardTrustItem.HardTrustItemID;
db.SubmitChanges();
}
}
///
/// 根据硬度主键删除相关明细信息
///
///
public static void DeleteHardTrustItemById(string hardTrustId)
{
Model.HJGLDB db = Funs.DB;
var hardTrustItem = (from x in db.Hard_TrustItem where x.HardTrustID == hardTrustId select x).ToList();
if (hardTrustItem != null)
{
db.Hard_TrustItem.DeleteAllOnSubmit(hardTrustItem);
db.SubmitChanges();
}
}
///
/// 根据项目ID、硬度Id获取相关明细视图信息
///
///
///
///
public static List GetViewHardTrustItem(string hardTrustId)
{
return (from x in Funs.DB.View_Hard_TrustItem where x.HardTrustID == hardTrustId select x).ToList();
}
}
}