lixiaojun
2024-09-09 c0f3c3f170846197d8d3f74ac123e0ac93a6dd67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace IStation.Application.SZJT
{
    /// <summary>
    /// 
    /// </summary>
    public class QueryDmaSiteMonthStatusListInput : IValidatableObject
    {
        /// <summary>
        /// id
        /// </summary>
        [Required, Range(1, long.MaxValue, ErrorMessage = "ID 必须大于0")]
        public long ID { get; set; }
 
        /// <summary>
        /// 开始年份
        /// </summary>
        [Required]
        public int StartYear { get; set; }
 
        /// <summary>
        /// 结束年份
        /// </summary>
        [Required]
        public int EndYear { get; set; }
 
        /// <summary>
        /// 开始月份
        /// </summary>
        [Required, Range(1, 12, ErrorMessage = "StartMonth 合理区间为【1,12】")]
        public int StartMonth { get; set; }
 
        /// <summary>
        /// 结束月份
        /// </summary>
        [Required, Range(1, 12, ErrorMessage = "EndMonth 合理区间为【1,12】")]
        public int EndMonth { get; set; }
 
        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (StartYear > EndYear)
            {
                yield return new ValidationResult("开始年份不能晚于结束年份", new string[] { nameof(StartYear), nameof(EndYear) });
            }
        }
 
 
    }
}