public override CheckValueReturnModel CheckValue(object oValue) { CheckValueReturnModel resul = new CheckValueReturnModel() { Success = true }; if (Convert.ToInt64(oValue) < Min) { resul.Message = "数据小于设定最小值"; resul.Success = false; } else if (Convert.ToInt64(oValue) > Max) { resul.Message = "数据超过设定最大值"; resul.Success = false; } return(resul); }
public override CheckValueReturnModel CheckValue(object oValue) { CheckValueReturnModel resul = new CheckValueReturnModel() { Success = true }; if (oValue == null || string.IsNullOrEmpty(oValue.ToString())) { resul.Message = "数据为空,验证长度失败"; resul.Success = false; } else if (oValue.ToString().Length < MinLength) { resul.Message = "数据长度小于设定最小值"; resul.Success = false; } else if (oValue.ToString().Length > MaxLength) { resul.Message = "数据长度超过设定最大值"; resul.Success = false; } return(resul); }