feat 时段码增删改查

This commit is contained in:
2024-07-11 17:47:47 +08:00
parent 164c97d8e7
commit b697520cb4
12 changed files with 367 additions and 3 deletions

View File

@@ -0,0 +1,71 @@
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) });
}
}
}