using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Application { /// /// 重新分析月区间内的常规监测月记录Input /// public class AnalyAgainMonitorGeneralMonthRecordOfMonthRangeInput : IValidatableObject { /// /// 客户id /// [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID 必须大于0")] public long CorpID { get; set; } /// /// 常规实时测点id /// [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID 必须大于0")] public long MonitorPointID { get; set; } /// /// 开始年份 /// public int StartYear { get; set; } /// /// 开始月份 /// public int StartMonth { get; set; } /// /// 结束月份 /// public int EndYear { get; set; } /// /// 结束月份 /// public int EndMonth { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { var startDay = new DateTime(StartYear,StartMonth,1); var endDay = new DateTime(EndYear,EndMonth,1); if(startDay>endDay) { yield return new ValidationResult( "月份区间参数错误" , new[] { nameof(StartYear) } ); } } } }