50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace XP.ReportEngine.Models
|
|
{
|
|
/// <summary>
|
|
/// 报告服务结果 | Report service result
|
|
/// 封装报告生成的最终结果信息
|
|
/// Encapsulates the final result of report generation
|
|
/// </summary>
|
|
public class ReportServiceResult
|
|
{
|
|
/// <summary>
|
|
/// 是否成功 | Whether successful
|
|
/// </summary>
|
|
public bool IsSuccess { get; set; }
|
|
|
|
/// <summary>
|
|
/// 输出文件路径(成功时有值)| Output file path (has value when successful)
|
|
/// </summary>
|
|
public string OutputFilePath { get; set; }
|
|
|
|
/// <summary>
|
|
/// 报告编号 | Report ID
|
|
/// </summary>
|
|
public string ReportId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 错误信息(失败时有值)| Error message (has value when failed)
|
|
/// </summary>
|
|
public string ErrorMessage { get; set; }
|
|
|
|
/// <summary>
|
|
/// 异常对象(失败时有值)| Exception object (has value when failed)
|
|
/// </summary>
|
|
public Exception Exception { get; set; }
|
|
|
|
/// <summary>
|
|
/// 创建成功结果 | Create success result
|
|
/// </summary>
|
|
public static ReportServiceResult Success(string outputFilePath, string reportId)
|
|
=> new() { IsSuccess = true, OutputFilePath = outputFilePath, ReportId = reportId };
|
|
|
|
/// <summary>
|
|
/// 创建失败结果 | Create failure result
|
|
/// </summary>
|
|
public static ReportServiceResult Failure(string message, Exception ex = null)
|
|
=> new() { IsSuccess = false, ErrorMessage = message, Exception = ex };
|
|
}
|
|
}
|