using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IStation.Untity;
namespace IStation.Application
{
///
///
///
public class DemoGetMonitorAlarmRecordFluzzyPageListInput : IValidatableObject
{
///
/// 客户标识
///
[Required, Range(1, long.MaxValue, ErrorMessage = "CorpID 必须大于0")]
public long CorpID { get; set; }
///
/// 测点标识列表 用 , 隔开
///
public string MonitorPointIds { get; set; }
///
/// 报警类型
///
public string AlarmType { get; set; }
///
/// 报警等级
///
public int? AlarmLevel { get; set; }
///
/// 处理状态
///
public int? HandleStatus { get; set; }
///
/// 开始时间
///
public DateTime? StartTime { get; set; }
///
/// 结束时间
///
public DateTime? EndTime { get; set; }
///
/// 页索引
///
[Required, Range(1, int.MaxValue, ErrorMessage = "PageIndex 必须大于0")]
public int PageIndex { get; set; }
///
/// 页尺寸
///
[Required, Range(1, int.MaxValue, ErrorMessage = "PageSize 必须大于0")]
public int PageSize { get; set; }
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (StartTime.HasValue && EndTime.HasValue)
{
if (StartTime.Value > EndTime.Value)
{
yield return new ValidationResult(
"StartTime 必须小于 EndTime"
, new[] { nameof(StartTime) }
);
}
}
if (!string.IsNullOrEmpty(MonitorPointIds))
{
var ids = LongListHelper.ToList(MonitorPointIds);
if (ids == null || ids.Count < 1)
{
yield return new ValidationResult(
"MonitorPointIds 格式错误"
, new[] { nameof(MonitorPointIds) }
);
}
}
}
}
}