Exemplo n.º 1
0
 public override ValidationResult Validate(object value, CultureInfo cultureInfo)
 {
     if (string.IsNullOrWhiteSpace(value?.ToString()))
     {
         return(ValidationResult.ValidResult);
     }
     return(RuleHelper.IsNumberAndWord(value)
         ? ValidationResult.ValidResult
         : new ValidationResult(false, "请输入数字和字母"));
 }
 /// <summary>
 /// 检查不动产单元号
 /// </summary>
 /// <param name="table"></param>
 /// <param name="rownum"></param>
 /// <param name="value"></param>
 /// <param name="name"></param>
 private void CheckBDCDYH(String table, String id, String value, String name)
 {
     if (RuleHelper.IsNotEmpty(value)) // 可以为空
     {
         if (!RuleHelper.IsNumberAndWord(value))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,应是数字或字母");
             //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "格式错误,应是数字或字母");
             return;
         }
         if (!RuleHelper.IsRequiredLength(value, 28))
         {
             ErrorMsg.Add(table + "表中," + id + "的" + name + "格式错误,长度应是28位");
             //ErrorMsg.Add(table + "表中,第" + rownum + "行的" + name + "格式错误,长度应是28位");
             return;
         }
     }
 }