CgResQueryDto.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace DW5S.DTO
  8. {
  9. /// <summary>
  10. /// 参估结果时间范围查询参数模型
  11. /// </summary>
  12. public class CgResQueryDto : IValidatableObject
  13. {
  14. /// <summary>
  15. /// 任务编号
  16. /// </summary>
  17. [Range(0,double.MaxValue)]
  18. public int TaskInfoID { get; set; }
  19. /// <summary>
  20. /// 目标上行频点(Hz),为空值时查询所有频点的结果
  21. /// </summary>
  22. [Range(0,long.MaxValue)]
  23. public long? TarFrequpHz { get; set; }
  24. /// <summary>
  25. /// 开始时间
  26. /// </summary>
  27. public DateTime BeginTime { get; set; }
  28. /// <summary>
  29. /// 结束时间
  30. /// </summary>
  31. public DateTime EndTime { get; set; }
  32. /// <summary>
  33. /// 是否包含无效结果(无定位结果的参估结果)
  34. /// </summary>
  35. public bool IncludeInvalidate { get; set; } = false;
  36. /// <summary>
  37. ///
  38. /// </summary>
  39. /// <param name="validationContext"></param>
  40. /// <returns></returns>
  41. public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
  42. {
  43. if (BeginTime > EndTime)
  44. yield return new ValidationResult("开始时间不能大于结束时间!", new[] { nameof(BeginTime), nameof(EndTime) });
  45. }
  46. }
  47. }