CgResQueryDto.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 XdCxRhDW.Dto
  8. {
  9. /// <summary>
  10. /// 参估结果时间范围查询参数模型
  11. /// </summary>
  12. public class CgResQueryDto : IValidatableObject
  13. {
  14. /// <summary>
  15. /// 任务编号
  16. /// </summary>
  17. [RangeInt(0)]
  18. public int TaskInfoID { get; set; }
  19. /// <summary>
  20. /// 目标上行频点(Hz),为空值时查询所有频点的结果
  21. /// </summary>
  22. [RangeLong(0,IncludeMin =true)]
  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. /// <param name="validationContext"></param>
  36. /// <returns></returns>
  37. public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
  38. {
  39. if (BeginTime > EndTime)
  40. yield return new ValidationResult("开始时间不能大于结束时间!", new[] { nameof(BeginTime), nameof(EndTime) });
  41. }
  42. }
  43. }