Пример #1
0
        protected override string GetErrorMsgTpl()
        {
            StringBuilder enSb          = new StringBuilder();
            StringBuilder zhSb          = new StringBuilder();
            var           tIProgramTool = ToolFactory.CreateIProgramTool();

            if (tIProgramTool.IsNumericType(this.Value))
            {
                enSb.AppendFormat("{{FieldName}} must be less than {0}", this.Max);
                zhSb.AppendFormat("{{FieldName}}必须少于{0}", this.Max);
                return(this.mILanguageTool.Get(enSb.ToString(), zhSb.ToString()));
            }
            if (tIProgramTool.IsStringType(Value))
            {
                enSb.AppendFormat("{{FieldName}} length must be less than {0}", this.Max);
                zhSb.AppendFormat("{{FieldName}}长度必须少于{0}", this.Max);
                return(this.mILanguageTool.Get(enSb.ToString(), zhSb.ToString()));
            }
            if (tIProgramTool.IsDateTimeType(Value))
            {
                var dMaxString = ToolFactory.CreateICalenderTool().Format(Max);
                enSb.AppendFormat("{{FieldName}} must be less than {0}", dMaxString);
                zhSb.AppendFormat("{{FieldName}}必须少于{0}", dMaxString);
                return(this.mILanguageTool.Get(enSb.ToString(), zhSb.ToString()));
            }
            throw new Exception("无法自动检测比较类型");
        }