using FluentValidation; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OASystem.Domain.Dtos.Statistics { /// /// 企业利润dtos /// public class CorporateProfitDtos : UserPageFuncDtoBase { } public class CorporateProfitDtosDtoBaseFoalidator : AbstractValidator { public CorporateProfitDtosDtoBaseFoalidator() { RuleFor(it => it.PortType).InclusiveBetween(1, 3).WithMessage(MsgTips.Port); RuleFor(it => it.UserId).GreaterThan(1).WithMessage(MsgTips.UserId); RuleFor(it => it.PageId).GreaterThan(1).WithMessage(MsgTips.PageId); } } public class CorporateProfitExcelDownloadDto : CorporateProfitDtos { public string BeginDt { get; set; } public string EndDt { get; set; } } public class CorporateProfitExcelDownloadDtoFoalidator : AbstractValidator { public CorporateProfitExcelDownloadDtoFoalidator() { Include(new CorporateProfitDtosDtoBaseFoalidator()); RuleFor(it => it.BeginDt) .Must(dateString => DateTime.TryParse(dateString, out _)) .WithMessage("请输入有效开始的日期"); RuleFor(it => it.EndDt) .Must(dateString => DateTime.TryParse(dateString, out _)) .WithMessage("请输入有效结束的日期"); } } }