71 lines
1.7 KiB
C#
71 lines
1.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.Entity.Device.Enums;
|
|
|
|
namespace Dlhis.Basic.Device.Request;
|
|
|
|
public class DeviceTimePeriodSaveRequest : IValidatableObject
|
|
{
|
|
public long? Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 卡类型 timeperiod
|
|
/// </summary>
|
|
[Range(2, 3)]
|
|
public int CardType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分配类型 DeviceTimePeriodAssignEnumType
|
|
/// </summary>
|
|
[EnumDataType(typeof(DeviceTimePeriodAssignEnumType))]
|
|
public DeviceTimePeriodAssignEnumType AssignType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分配值
|
|
/// </summary>
|
|
[Required]
|
|
public Guid Value { get; set; }
|
|
|
|
/// <summary>
|
|
/// 上班开始
|
|
/// </summary>
|
|
[Required]
|
|
public TimeOnly OnStart { get; set; }
|
|
|
|
/// <summary>
|
|
/// 上班结束
|
|
/// </summary>
|
|
[Required]
|
|
public TimeOnly OnEnd { get; set; }
|
|
|
|
/// <summary>
|
|
/// 下班开始
|
|
/// </summary>
|
|
[Required]
|
|
public TimeOnly OffStart { get; set; }
|
|
|
|
/// <summary>
|
|
/// 下班结束
|
|
/// </summary>
|
|
[Required]
|
|
public TimeOnly OffEnd { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (OnStart >= OnEnd)
|
|
{
|
|
yield return new ValidationResult("上班时段范围有误", new[] { nameof(OnStart) });
|
|
}
|
|
|
|
if (OffStart >= OffEnd)
|
|
{
|
|
yield return new ValidationResult("下班时段范围有误", new[] { nameof(OffStart) });
|
|
}
|
|
|
|
|
|
if (OnEnd >= OffStart)
|
|
{
|
|
yield return new ValidationResult("上下班时段范围有误", new[] { nameof(OnEnd) });
|
|
}
|
|
}
|
|
} |