123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace XdCxRhDw.Dto
- {
- /// <summary>
- /// 定位结果查询参数模型
- /// </summary>
- public class PosResQueryDto:IValidatableObject
- {
- /// <summary>
- /// 任务编号
- /// </summary>
- [RangeInt(0)]
- public int TaskInfoID { get; set; }
- /// <summary>
- /// 开始时间
- /// </summary>
- public DateTime BeginTime { get; set; }
- /// <summary>
- /// 结束时间
- /// </summary>
- public DateTime EndTime { get; set; }
- /// <summary>
- ///
- /// </summary>
- /// <param name="validationContext"></param>
- /// <returns></returns>
- public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
- {
- if ((EndTime - BeginTime).TotalDays > 10)
- yield return new ValidationResult("时间跨度不能超过10天!", new[] { nameof(BeginTime),nameof(EndTime) });
- }
- }
- }
|