xinjiang/SGGL/BLL/TestRun/ProduceProperty/PropertyRunReportService.cs

89 lines
4.3 KiB
C#
Raw Normal View History

2024-11-19 09:45:27 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 运行报表管理
/// </summary>
public static class PropertyRunReportService
{
/// <summary>
/// 根据主键获取运行报表管理信息
/// </summary>
/// <param name="PropertyRunReportId"></param>
/// <returns></returns>
public static Model.ProduceProperty_PropertyRunReport GetPropertyRunReportById(string PropertyRunReportId)
{
return Funs.DB.ProduceProperty_PropertyRunReport.FirstOrDefault(e => e.PropertyRunReportId == PropertyRunReportId);
}
/// <summary>
/// 添加运行报表管理信息
/// </summary>
/// <param name="PropertyRunReport"></param>
public static void AddPropertyRunReport(Model.ProduceProperty_PropertyRunReport PropertyRunReport)
{
Model.ProduceProperty_PropertyRunReport newPropertyRunReport = new Model.ProduceProperty_PropertyRunReport();
newPropertyRunReport.PropertyRunReportId = PropertyRunReport.PropertyRunReportId;
newPropertyRunReport.ProjectId = PropertyRunReport.ProjectId;
newPropertyRunReport.Code = PropertyRunReport.Code;
newPropertyRunReport.UnitWorkId = PropertyRunReport.UnitWorkId;
newPropertyRunReport.InstallationMan = PropertyRunReport.InstallationMan;
newPropertyRunReport.ReportName = PropertyRunReport.ReportName;
newPropertyRunReport.ReportCode = PropertyRunReport.ReportCode;
newPropertyRunReport.ReportMan = PropertyRunReport.ReportMan;
newPropertyRunReport.StartDate = PropertyRunReport.StartDate;
newPropertyRunReport.EndDate = PropertyRunReport.EndDate;
newPropertyRunReport.AttachUrl = PropertyRunReport.AttachUrl;
newPropertyRunReport.Remark = PropertyRunReport.Remark;
Funs.DB.ProduceProperty_PropertyRunReport.InsertOnSubmit(newPropertyRunReport);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改运行报表管理
/// </summary>
/// <param name="PropertyRunReport"></param>
public static void UpdatePropertyRunReport(Model.ProduceProperty_PropertyRunReport PropertyRunReport)
{
Model.ProduceProperty_PropertyRunReport newPropertyRunReport = Funs.DB.ProduceProperty_PropertyRunReport.FirstOrDefault(e => e.PropertyRunReportId == PropertyRunReport.PropertyRunReportId);
if (newPropertyRunReport != null)
{
newPropertyRunReport.Code = PropertyRunReport.Code;
newPropertyRunReport.UnitWorkId = PropertyRunReport.UnitWorkId;
newPropertyRunReport.InstallationMan = PropertyRunReport.InstallationMan;
newPropertyRunReport.ReportName = PropertyRunReport.ReportName;
newPropertyRunReport.ReportCode = PropertyRunReport.ReportCode;
//newPropertyRunReport.ReportMan = PropertyRunReport.ReportMan;
newPropertyRunReport.StartDate = PropertyRunReport.StartDate;
newPropertyRunReport.EndDate = PropertyRunReport.EndDate;
newPropertyRunReport.AttachUrl = PropertyRunReport.AttachUrl;
newPropertyRunReport.Remark = PropertyRunReport.Remark;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除运行报表管理
/// </summary>
/// <param name="PropertyRunReportId"></param>
public static void DeletePropertyRunReport(string PropertyRunReportId)
{
Model.ProduceProperty_PropertyRunReport PropertyRunReport = Funs.DB.ProduceProperty_PropertyRunReport.FirstOrDefault(e => e.PropertyRunReportId == PropertyRunReportId);
if (PropertyRunReport != null)
{
if (!string.IsNullOrEmpty(PropertyRunReport.AttachUrl))
{
BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, PropertyRunReport.AttachUrl);//删除附件
}
Funs.DB.ProduceProperty_PropertyRunReport.DeleteOnSubmit(PropertyRunReport);
Funs.DB.SubmitChanges();
}
}
}
}