using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Application { /// /// 能效并联 频率请求 /// public class EtaParallelHZLimitersInput : IValidatableObject { /// /// 客户标识 /// [Required, Range(1, long.MaxValue, ErrorMessage = "CorpID 必须大于0")] public long CorpID { get; set; } /// /// 对象类型 /// [Required, DataValidation(AllowEmptyStrings = false)] public string ObjectType { get; set; } /// /// 对象标识 /// [Required, Range(1, long.MaxValue, ErrorMessage = "ObjectID 必须大于0")] public long ObjectID { get; set; } /// /// 开始日期 (应小于结束日期) /// [Required] public DateTime StartDay { get; set; } /// /// 结束日期(应大于开始日期) /// [Required] public DateTime EndDay { get; set; } /// /// /// [Required] public List Items { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (StartDay.Date > EndDay.Date) { yield return new ValidationResult( "StartDay 必须小于等于 EndDay" , new[] { nameof(StartDay) } ); } } } }