26 lines
867 B
C#
26 lines
867 B
C#
using e_suite.Database.Core.Tables.Contacts;
|
|
using e_suite.Database.Core.Tables.Domain;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using e_suite.Workflow.Core.Enums;
|
|
using e_suite.Workflow.Core.Interfaces;
|
|
|
|
namespace e_suite.Workflow.Core;
|
|
|
|
public class TaskAssignee : ITaskAssignee, IValidatableObject
|
|
{
|
|
public Role? Role { get; set; }
|
|
public Contact? Contact { get; set; }
|
|
public Raci Raci { get; set; }
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (!((Role != null) ^ (Contact != null))) //Role Xor Contact means either must be set, but not both the same
|
|
{
|
|
yield return new ValidationResult(
|
|
"Either Role or Contact must be set, but not both.",
|
|
[nameof(Role), nameof(Contact)]
|
|
);
|
|
}
|
|
}
|
|
|
|
} |