CorporateProfitDtos.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using FluentValidation;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace OASystem.Domain.Dtos.Statistics
  8. {
  9. /// <summary>
  10. /// 企业利润dtos
  11. /// </summary>
  12. public class CorporateProfitDtos : UserPageFuncDtoBase
  13. {
  14. }
  15. public class CorporateProfitDtosDtoBaseFoalidator : AbstractValidator<CorporateProfitDtos>
  16. {
  17. public CorporateProfitDtosDtoBaseFoalidator()
  18. {
  19. RuleFor(it => it.PortType).InclusiveBetween(1, 3).WithMessage(MsgTips.Port);
  20. RuleFor(it => it.UserId).GreaterThan(1).WithMessage(MsgTips.UserId);
  21. RuleFor(it => it.PageId).GreaterThan(1).WithMessage(MsgTips.PageId);
  22. }
  23. }
  24. public class CorporateProfitExcelDownloadDto : CorporateProfitDtos
  25. {
  26. public string BeginDt { get; set; }
  27. public string EndDt { get; set; }
  28. }
  29. public class CorporateProfitExcelDownloadDtoFoalidator : AbstractValidator<CorporateProfitExcelDownloadDto>
  30. {
  31. public CorporateProfitExcelDownloadDtoFoalidator()
  32. {
  33. Include(new CorporateProfitDtosDtoBaseFoalidator());
  34. RuleFor(it => it.BeginDt)
  35. .Must(dateString => DateTime.TryParse(dateString, out _))
  36. .WithMessage("请输入有效开始的日期");
  37. RuleFor(it => it.EndDt)
  38. .Must(dateString => DateTime.TryParse(dateString, out _))
  39. .WithMessage("请输入有效结束的日期");
  40. }
  41. }
  42. }