提交
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Appointment.Entity.ValidateAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 必填项
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Add:yuangb 2019-3-11
|
||||
/// [StringRequired(ErrorMessage ="状态不能为空")]
|
||||
/// </remarks>
|
||||
public class StringRequiredAttribute : ValidateAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 报错提示信息
|
||||
/// </summary>
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public override string Validate(object oValue)
|
||||
{
|
||||
if (oValue == null || string.IsNullOrWhiteSpace(oValue.ToString()))
|
||||
{
|
||||
return ErrorMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user