Basf_TCC11/HJGL/BLL/HotProcessHard/HotProessReportService.cs

77 lines
3.2 KiB
C#

using System.Linq;
namespace BLL
{
/// <summary>
/// 热处理报告
/// </summary>
public static class HotProessReportService
{
/// <summary>
/// 根据主键获取热处理报告
/// </summary>
/// <param name="hotProessReportId"></param>
/// <returns></returns>
public static Model.HotProess_Report GetHotProessReportById(string hotProessReportId)
{
return Funs.DB.HotProess_Report.FirstOrDefault(e => e.HotProessReportId == hotProessReportId);
}
/// <summary>
/// 添加热处理报告
/// </summary>
/// <param name="hotProessReport"></param>
public static void AddHotProessReport(Model.HotProess_Report hotProessReport)
{
Model.HJGLDB db = Funs.DB;
Model.HotProess_Report newHotProessReport = new Model.HotProess_Report();
newHotProessReport.HotProessReportId = hotProessReport.HotProessReportId;
newHotProessReport.HotProessTrustItemId = hotProessReport.HotProessTrustItemId;
newHotProessReport.WeldJointId = hotProessReport.WeldJointId;
newHotProessReport.PointCount = hotProessReport.PointCount;
newHotProessReport.RequiredT = hotProessReport.RequiredT;
newHotProessReport.ActualT = hotProessReport.ActualT;
newHotProessReport.RequestTime = hotProessReport.RequestTime;
newHotProessReport.ActualTime = hotProessReport.ActualTime;
newHotProessReport.RecordChartNo = hotProessReport.RecordChartNo;
db.HotProess_Report.InsertOnSubmit(newHotProessReport);
db.SubmitChanges();
}
/// <summary>
/// 修改热处理报告
/// </summary>
/// <param name="hotProessReport"></param>
public static void UpdateHotProessReport(Model.HotProess_Report hotProessReport)
{
Model.HJGLDB db = Funs.DB;
Model.HotProess_Report newHotProessReport = db.HotProess_Report.FirstOrDefault(e => e.HotProessReportId == hotProessReport.HotProessReportId);
if (newHotProessReport != null)
{
newHotProessReport.PointCount = hotProessReport.PointCount;
newHotProessReport.RequiredT = hotProessReport.RequiredT;
newHotProessReport.ActualT = hotProessReport.ActualT;
newHotProessReport.RequestTime = hotProessReport.RequestTime;
newHotProessReport.ActualTime = hotProessReport.ActualTime;
newHotProessReport.RecordChartNo = hotProessReport.RecordChartNo;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除热处理报告
/// </summary>
/// <param name="hotProessReportId"></param>
public static void DeleteHotProessReportById(string hotProessReportId)
{
Model.HJGLDB db = Funs.DB;
Model.HotProess_Report hotProessReport = db.HotProess_Report.FirstOrDefault(e => e.HotProessReportId == hotProessReportId);
if (hotProessReport != null)
{
db.HotProess_Report.DeleteOnSubmit(hotProessReport);
db.SubmitChanges();
}
}
}
}