using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
///
/// 无损检测周/月报
///
public class NDTReportService
{
///
/// 根据主键获取无损检测委托单周/月报信息
///
///
///
public static Model.NDTReport GetNDTReportById(string ndtReportId)
{
return Funs.DB.NDTReport.FirstOrDefault(e => e.NDTReportId == ndtReportId);
}
///
/// 根据项目Id,类型获取无损检测报表
///
///
///
///
public static List GetNDTReportByProjectId(string projectId, string type)
{
return (from x in Funs.DB.NDTReport where x.ProjectId == projectId && x.RType == type select x).ToList();
}
///
/// 添加周/月报
///
///
public static void AddNDTReort(Model.NDTReport ndtReport)
{
Model.NDTReport newNDTReport = new Model.NDTReport();
newNDTReport.NDTReportId = ndtReport.NDTReportId;
newNDTReport.ProjectId = ndtReport.ProjectId;
newNDTReport.StartDate = ndtReport.StartDate;
newNDTReport.EndDate = ndtReport.EndDate;
newNDTReport.RType = ndtReport.RType;
Funs.DB.NDTReport.InsertOnSubmit(newNDTReport);
Funs.DB.SubmitChanges();
}
public static void UpdateNDTReport(Model.NDTReport ndtReport)
{
Model.NDTReport newNDTReport = Funs.DB.NDTReport.FirstOrDefault(e => e.NDTReportId == ndtReport.NDTReportId);
if (newNDTReport != null)
{
newNDTReport.ProjectId = ndtReport.ProjectId;
newNDTReport.StartDate = ndtReport.StartDate;
newNDTReport.EndDate = ndtReport.EndDate;
newNDTReport.RType = ndtReport.RType;
Funs.DB.SubmitChanges();
}
}
///
/// 根据主键删除周/月报
///
///
public static void DeleteNDTReportById(string ndtReportId)
{
Model.NDTReport ndtReport = Funs.DB.NDTReport.FirstOrDefault(e => e.NDTReportId == ndtReportId);
if (ndtReport != null)
{
Funs.DB.NDTReport.DeleteOnSubmit(ndtReport);
Funs.DB.SubmitChanges();
}
}
}
}