lixiaojun
2022-08-12 424d2d20a24b76850b73fae8ecc9bc98505be4f5
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Application
{
    /// <summary>
    /// 重新分析月区间内的常规监测月记录Input
    /// </summary>
    public class AnalyAgainMonitorGeneralMonthRecordOfMonthRangeInput : IValidatableObject
    {
        /// <summary>
        /// 客户id
        /// </summary>
        [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID 必须大于0")]
        public long CorpID { get; set; }
 
        /// <summary>
        /// 常规实时测点id
        /// </summary>
        [Required, Range(1, long.MaxValue, ErrorMessage = "MonitorPointID 必须大于0")]
        public long MonitorPointID { get; set; }
 
        /// <summary>
        /// 开始年份
        /// </summary>
        public int StartYear { get; set; }
 
        /// <summary>
        /// 开始月份
        /// </summary>
        public int StartMonth { get; set; }
 
        /// <summary>
        /// 结束月份
        /// </summary>
        public int EndYear { get; set; }
 
        /// <summary>
        /// 结束月份
        /// </summary>
        public int EndMonth { get; set; }
 
        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<ValidationResult> 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) }
                    );
 
            }
        }
 
    }
}