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 QueryEtaHeatRectDetailInput : 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 double Qmin { get; set; } /// /// 流量最大值 /// [Required] public double Qmax { get; set; } /// /// 扬程最小值 /// [Required] public double Hmin { get; set; } /// /// 扬程最大值 /// [Required] public double Hmax { get; set; } /// /// 开始日期 (应小于结束日期) /// [Required] public DateTime StartDay { get; set; } /// /// 结束日期(应大于开始日期) /// [Required] public DateTime EndDay { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (StartDay.Date > EndDay.Date) { yield return new ValidationResult( "StartDay 必须小于等于 EndDay" , new[] { nameof(StartDay) } ); } if (Qmin > Qmax) { yield return new ValidationResult( "流量区间参数错误" , new[] { nameof(Qmin) } ); } if (Hmin > Hmax) { yield return new ValidationResult( "扬程区间参数错误" , new[] { nameof(Hmin) } ); } } } }