47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
|
|
namespace LCU.Library.Internal.DocumentIngestorModels.Models;
|
|
public class DocumentProcessingInfoStatusRequest : IValidatableObject
|
|
{
|
|
public DocumentProcessingInfoStatusRequest()
|
|
{
|
|
}
|
|
|
|
public DocumentProcessingInfoStatusRequest(int documentProcessingInfoId,
|
|
ProcessStatusTypes processStatus,
|
|
string reasonMessage,
|
|
string username)
|
|
{
|
|
DocumentProcessingInfoId = documentProcessingInfoId;
|
|
ProcessStatus = processStatus;
|
|
ReasonMessage = reasonMessage;
|
|
Username = username;
|
|
}
|
|
|
|
public int DocumentProcessingInfoId { get; set; }
|
|
public ProcessStatusTypes ProcessStatus { get; set; }
|
|
public string ReasonMessage { get; set; } = string.Empty;
|
|
public string Username { get; set; } = string.Empty;
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (DocumentProcessingInfoId == 0 || DocumentProcessingInfoId == null)
|
|
{
|
|
yield return new ValidationResult("DocumentProcessingInfoId cannot be 0 or null.");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(ReasonMessage))
|
|
{
|
|
yield return new ValidationResult("Must provide a ReasonMessage explaining the reason for the update.");
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(Username))
|
|
{
|
|
yield return new ValidationResult("Must provide a Username.");
|
|
}
|
|
}
|
|
}
|