/// <summary> /// 设置一个规则 /// </summary> /// <param name="Input">输入表中的key</param> /// <param name="vaildate">校验规则</param> /// <param name="filter">过滤规则</param> /// <returns></returns> public bool Set(string Input, VaildItem vaildate, VaildItem filter) { if (SetFilter(Input, filter) && SetVaildate(Input, vaildate)) { return(true); } return(false); }
/// <summary> /// 设置一个校验规则 /// </summary> /// <param name="Input">需要校验的字段名</param> /// <param name="vi">规则</param> /// <returns></returns> public bool SetVaildate(string Input, VaildItem vi) { if (vi == null) { return true; } if (string.IsNullOrEmpty(vi.Name) || !v.HasValidate(vi.Name)) return false; if (Validate.ContainsKey(Input)) Validate[Input].Add(vi); else Validate.Add(Input, new List<VaildItem>() { vi }); return true; }
/// <summary> /// 设置一个校验规则 /// </summary> /// <param name="Input">需要校验的字段名</param> /// <param name="vi">规则</param> /// <returns></returns> public bool SetVaildate(string Input, VaildItem vi) { if (vi == null) { return(true); } if (string.IsNullOrEmpty(vi.Name) || !v.HasValidate(vi.Name)) { return(false); } if (Validate.ContainsKey(Input)) { Validate[Input].Add(vi); } else { Validate.Add(Input, new List <VaildItem>() { vi }); } return(true); }
/// <summary> /// 设置一个过滤规则 /// </summary> /// <param name="Input">需要校验的字段名</param> /// <param name="vi">规则</param> /// <returns></returns> public bool SetFilter(string Input, VaildItem vi) { if (vi == null) { return(true); } if (string.IsNullOrEmpty(vi.Name) || !f.HasFormat(vi.Name)) { return(false); } if (Formater.ContainsKey(Input)) { Formater[Input].Add(vi); } else { Formater.Add(Input, new List <VaildItem>() { vi }); } return(true); }
/// <summary> /// 设置一个过滤规则 /// </summary> /// <param name="Input">需要校验的字段名</param> /// <param name="vi">规则</param> /// <returns></returns> public bool SetFilter(string Input, VaildItem vi) { if (vi == null) { return true; } if (string.IsNullOrEmpty(vi.Name) || !f.HasFormat(vi.Name)) return false; if (Formater.ContainsKey(Input)) Formater[Input].Add(vi); else Formater.Add(Input, new List<VaildItem>() { vi }); return true; }
/// <summary> /// 设置一个规则 /// </summary> /// <param name="Input">输入表中的key</param> /// <param name="vaildate">校验规则</param> /// <param name="filter">过滤规则</param> /// <returns></returns> public bool Set(string Input, VaildItem vaildate, VaildItem filter) { if (SetFilter(Input, filter) && SetVaildate(Input, vaildate)) return true; return false; }