80 lines
2.8 KiB
C#
80 lines
2.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 无损检测周/月报
|
|||
|
/// </summary>
|
|||
|
public class NDTReportService
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 根据主键获取无损检测委托单周/月报信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="ndtReportId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.NDTReport GetNDTReportById(string ndtReportId)
|
|||
|
{
|
|||
|
return Funs.DB.NDTReport.FirstOrDefault(e => e.NDTReportId == ndtReportId);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据项目Id,类型获取无损检测报表
|
|||
|
/// </summary>
|
|||
|
/// <param name="projectId"></param>
|
|||
|
/// <param name="type"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static List<Model.NDTReport> GetNDTReportByProjectId(string projectId, string type)
|
|||
|
{
|
|||
|
return (from x in Funs.DB.NDTReport where x.ProjectId == projectId && x.RType == type select x).OrderByDescending(x=>x.StartDate).ToList();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 添加周/月报
|
|||
|
/// </summary>
|
|||
|
/// <param name="ndtReport"></param>
|
|||
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据主键删除周/月报
|
|||
|
/// </summary>
|
|||
|
/// <param name="ndtReportId"></param>
|
|||
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|