feat 时段码增删改查
This commit is contained in:
@@ -76,6 +76,10 @@ public class DeviceSaveRequest : IValidatableObject
|
||||
/// </summary>
|
||||
public bool AsAttendance { get; set; }
|
||||
|
||||
|
||||
public bool EnableTimePeriod { get; set; }
|
||||
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Type != DeviceTypeEnumType.Door && AsAttendance)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceTimePeriodPageRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// DeviceTimePeriodAssignEnumType
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(DeviceTimePeriodAssignEnumType))]
|
||||
public DeviceTimePeriodAssignEnumType AssignType { get; set; }
|
||||
}
|
||||
@@ -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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user