51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Dlhis.Entity.Canteen.Enums;
|
|
using Kurisu.AspNetCore.CustomClass;
|
|
|
|
namespace Dlhis.Basic.BusinessShift.Request;
|
|
|
|
public class BusinessPlaceShiftSaveMealShiftRequest : IValidatableObject
|
|
{
|
|
public long? Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// 餐别Code
|
|
/// </summary>
|
|
public Guid ShiftCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 餐次 ShiftEnumType
|
|
/// </summary>
|
|
[EnumDataType(typeof(ShiftEnumType))]
|
|
public ShiftEnumType ShiftType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 序号
|
|
/// </summary>
|
|
public int Sequence { get; set; } = 100;
|
|
|
|
/// <summary>
|
|
/// 时间段
|
|
/// </summary>
|
|
public TimePeriod TimePeriod { get; set; }
|
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (TimePeriod == null)
|
|
{
|
|
yield return new ValidationResult("时间段配置错误", new[] { nameof(TimePeriod) });
|
|
}
|
|
|
|
if (TimePeriod?.Start == null || TimePeriod?.End == null)
|
|
{
|
|
yield return new ValidationResult("时间段配置错误", new[] { nameof(TimePeriod) });
|
|
}
|
|
|
|
if (TimePeriod.Start == TimePeriod.End)
|
|
{
|
|
yield return new ValidationResult("时间段设置区间有误,开始时段不能等于结束时段.", new[] { nameof(TimePeriod) });
|
|
}
|
|
}
|
|
}
|