You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB
C#

using EntrustSettle.Model.Dtos;
using FluentValidation;
namespace EntrustSettle.Model.Validator
{
public class OrderSubmitDtoValidator : AbstractValidator<OrderSubmitDto>
{
public OrderSubmitDtoValidator()
{
RuleFor(x => x.MblnoList).NotEmpty();
RuleFor(x => x.CompanyId).NotNull().NotEmpty();
RuleFor(x => x.CompanyName).NotNull().NotEmpty();
RuleFor(x => x.ContactId).NotNull().NotEmpty();
RuleFor(x => x.ContactName).NotNull().NotEmpty();
RuleFor(x => x.BusinessType).ExclusiveBetween<OrderSubmitDto, byte>(1, 5);
//RuleFor(x => x.Remark).MaximumLength(2000).WithMessage("备注过长");
RuleFor(x => x.AnnexIdList.Length).LessThanOrEqualTo(5).WithMessage("附件数量不能超过5个");
}
}
public class FileTypeEnumValidator : AbstractValidator<FileTypeEnum>
{
public FileTypeEnumValidator()
{
RuleFor(x => x).IsInEnum();
}
}
public class ChangeStatusDtoValidator : AbstractValidator<ChangeStatusDto>
{
public ChangeStatusDtoValidator()
{
RuleFor(x => x.Status).IsInEnum();
}
}
}