39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.Entity.Basic.Enums;
|
|
|
|
namespace Dlhis.Basic.WorkGrids.Request;
|
|
|
|
public class WorkGridScheduleSaveRequest : IValidatableObject
|
|
{
|
|
/// <summary>
|
|
/// 网格code
|
|
/// </summary>
|
|
public Guid WorkGridCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 排班日期
|
|
/// </summary>
|
|
public DateOnly Date { get; set; }
|
|
|
|
/// <summary>
|
|
/// 班次
|
|
/// </summary>
|
|
[EnumDataType(typeof(WorkGridTimePeriodEnumType), ErrorMessage = "班次类型错误")]
|
|
public WorkGridTimePeriodEnumType PeriodType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 人员codes
|
|
/// </summary>
|
|
[MinLength(1, ErrorMessage = "人员不可为空")]
|
|
public List<string> UserCodes { get; set; }
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
var now = DateTime.Now;
|
|
if (Date.ToDateTime(new TimeOnly(0, 0)) < now.Date)
|
|
{
|
|
yield return new ValidationResult("不可编辑历史数据", new[] { nameof(Date) });
|
|
}
|
|
}
|
|
} |