61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using System;
|
||
|
||
namespace NPP.SmartSchedue.Api.Contracts.Services.Notification.Output;
|
||
|
||
/// <summary>
|
||
/// 发送系统消息输出模型
|
||
/// </summary>
|
||
public class SendSystemMessageOutput
|
||
{
|
||
/// <summary>
|
||
/// 是否发送成功
|
||
/// </summary>
|
||
public bool Success { get; set; }
|
||
|
||
/// <summary>
|
||
/// 消息ID(发送成功时返回)
|
||
/// </summary>
|
||
public long? MessageId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 错误消息(发送失败时返回)
|
||
/// </summary>
|
||
public string ErrorMessage { get; set; } = "";
|
||
|
||
/// <summary>
|
||
/// 发送时间
|
||
/// </summary>
|
||
public DateTime? SentTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// 接收人员ID
|
||
/// </summary>
|
||
public long RecipientPersonnelId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 创建成功结果
|
||
/// </summary>
|
||
public static SendSystemMessageOutput CreateSuccess(long messageId, long recipientPersonnelId, DateTime sentTime)
|
||
{
|
||
return new SendSystemMessageOutput
|
||
{
|
||
Success = true,
|
||
MessageId = messageId,
|
||
RecipientPersonnelId = recipientPersonnelId,
|
||
SentTime = sentTime
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 创建失败结果
|
||
/// </summary>
|
||
public static SendSystemMessageOutput CreateFailure(long recipientPersonnelId, string errorMessage)
|
||
{
|
||
return new SendSystemMessageOutput
|
||
{
|
||
Success = false,
|
||
RecipientPersonnelId = recipientPersonnelId,
|
||
ErrorMessage = errorMessage
|
||
};
|
||
}
|
||
} |