fix 作为考勤设备判断
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceSaveRequest
|
||||
public class DeviceSaveRequest : IValidatableObject
|
||||
{
|
||||
public long? Id { get; set; }
|
||||
|
||||
@@ -70,4 +71,17 @@ public class DeviceSaveRequest
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否作为考勤设备
|
||||
/// </summary>
|
||||
public bool AsAttendance { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if (Type != DeviceTypeEnumType.Door && AsAttendance)
|
||||
{
|
||||
yield return new ValidationResult($"{DeviceTypeEnumType.Door.GetDescription()}才可设置作为考勤设备", new[] { nameof(AsAttendance) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user