29 lines
780 B
C#
29 lines
780 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using Kurisu.AspNetCore.Utils.Extensions;
|
|
|
|
namespace Dlhis.Canteen.MealSupplementRecord.Request;
|
|
|
|
public class MealSupplementInitImportRequest : IValidatableObject
|
|
{
|
|
[Required(ErrorMessage = "工号不能为空")]
|
|
public string Code { get; set; }
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// 余额
|
|
/// </summary>
|
|
public decimal Balance { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
Balance = decimal.Parse(Balance.ToString("F2"));
|
|
|
|
if (Name.IsEmpty())
|
|
{
|
|
yield return new ValidationResult($"工号{Code}姓名不能为空", new[] { nameof(Name) });
|
|
}
|
|
}
|
|
} |