Exemple #1
0
        /// <summary>
        /// 表示一般验证框对象
        /// <param name="validType">验证类型</param>
        /// <param name="validMessage">不通过时提示信息</param>
        /// <param name="parameters">验证的参数</param>
        /// </summary>
        public static ValidBox New(string validType, string validMessage, params object[] parameters)
        {
            var box  = new ValidBox();
            var rule = ValidBox.GenerateRule(validType, validMessage, parameters);

            box.validRuleList.Add(rule);
            return(box);
        }
Exemple #2
0
        /// <summary>
        /// 验证框合并操作
        /// 返回合并后的验证框
        /// </summary>
        /// <param name="box1">要合并的对象1</param>
        /// /// <param name="box2">要合并的对象2</param>
        /// <returns></returns>
        public static ValidBox Merge(ValidBox box1, ValidBox box2)
        {
            var box = new ValidBox();

            box.validRuleList.AddRange(box1.validRuleList);
            box.validRuleList.AddRange(box2.validRuleList);

            box.required        = box1.required ? box1.required : box2.required;
            box.requiredMessage = box1.required ? box1.requiredMessage : box2.requiredMessage;
            box.message         = string.IsNullOrEmpty(box1.message) ? box2.message : box1.message;
            return(box);
        }
Exemple #3
0
        /// <summary>
        /// 验证框合并操作
        /// 返回合并后的验证框
        /// </summary>       
        /// <param name="box1">要合并的对象1</param>
        /// /// <param name="box2">要合并的对象2</param>
        /// <returns></returns>
        public static ValidBox Merge(ValidBox box1, ValidBox box2)
        {
            var box = new ValidBox();
            box.validRuleList.AddRange(box1.validRuleList);
            box.validRuleList.AddRange(box2.validRuleList);

            box.required = box1.required ? box1.required : box2.required;
            box.requiredMessage = box1.required ? box1.requiredMessage : box2.requiredMessage;
            box.message = string.IsNullOrEmpty(box1.message) ? box2.message : box1.message;
            return box;
        }
Exemple #4
0
 /// <summary>
 /// 表示一般验证框对象
 /// <param name="validType">验证类型</param>
 /// <param name="validMessage">不通过时提示信息</param>
 /// <param name="parameters">验证的参数</param>
 /// </summary>
 public static ValidBox New(string validType, string validMessage, params object[] parameters)
 {
     var box = new ValidBox();
     var rule = ValidBox.GenerateRule(validType, validMessage, parameters);
     box.validRuleList.Add(rule);
     return box;
 }