Esempio n. 1
0
 public static string GetText(EInputValidateType type)
 {
     if (type == EInputValidateType.None)
     {
         return("无");
     }
     else if (type == EInputValidateType.Chinese)
     {
         return("中文");
     }
     else if (type == EInputValidateType.English)
     {
         return("英文");
     }
     else if (type == EInputValidateType.Email)
     {
         return("Email格式");
     }
     else if (type == EInputValidateType.Url)
     {
         return("网址格式");
     }
     else if (type == EInputValidateType.Phone)
     {
         return("电话号码");
     }
     else if (type == EInputValidateType.Mobile)
     {
         return("手机号码");
     }
     else if (type == EInputValidateType.Integer)
     {
         return("整数");
     }
     else if (type == EInputValidateType.Currency)
     {
         return("货币格式");
     }
     else if (type == EInputValidateType.Zip)
     {
         return("邮政编码");
     }
     else if (type == EInputValidateType.IdCard)
     {
         return("身份证号码");
     }
     else if (type == EInputValidateType.QQ)
     {
         return("QQ号码");
     }
     else if (type == EInputValidateType.Custom)
     {
         return("自定义正则表达式验证");
     }
     else
     {
         throw new Exception();
     }
 }
Esempio n. 2
0
 public static string GetValue(EInputValidateType type)
 {
     if (type == EInputValidateType.None)
     {
         return("None");
     }
     else if (type == EInputValidateType.Chinese)
     {
         return("Chinese");
     }
     else if (type == EInputValidateType.English)
     {
         return("English");
     }
     else if (type == EInputValidateType.Email)
     {
         return("Email");
     }
     else if (type == EInputValidateType.Url)
     {
         return("Url");
     }
     else if (type == EInputValidateType.Phone)
     {
         return("Phone");
     }
     else if (type == EInputValidateType.Mobile)
     {
         return("Mobile");
     }
     else if (type == EInputValidateType.Integer)
     {
         return("Integer");
     }
     else if (type == EInputValidateType.Currency)
     {
         return("Currency");
     }
     else if (type == EInputValidateType.Zip)
     {
         return("Zip");
     }
     else if (type == EInputValidateType.IdCard)
     {
         return("IdCard");
     }
     else if (type == EInputValidateType.QQ)
     {
         return("QQ");
     }
     else if (type == EInputValidateType.Custom)
     {
         return("Custom");
     }
     else
     {
         throw new Exception();
     }
 }
Esempio n. 3
0
        public static ListItem GetListItem(EInputValidateType type, bool selected)
        {
            var item = new ListItem(GetText(type), GetValue(type));

            if (selected)
            {
                item.Selected = true;
            }
            return(item);
        }
Esempio n. 4
0
 public static bool Equals(EInputValidateType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 5
0
        public static void GetValidateAttributesForListItem(ListControl control, bool isValidate, string displayName, bool isRequire, int minNum, int maxNum, EInputValidateType validateType, string regExp, string errorMessage)
        {
            if (!isValidate)
            {
                return;
            }

            control.Attributes.Add("isValidate", true.ToString().ToLower());
            control.Attributes.Add("displayName", displayName);
            control.Attributes.Add("isRequire", isRequire.ToString().ToLower());
            control.Attributes.Add("minNum", minNum.ToString());
            control.Attributes.Add("maxNum", maxNum.ToString());
            control.Attributes.Add("validateType", EInputValidateTypeUtils.GetValue(validateType));
            control.Attributes.Add("regExp", regExp);
            control.Attributes.Add("errorMessage", errorMessage);
            control.Attributes.Add("isListItem", true.ToString().ToLower());
        }
Esempio n. 6
0
 public static string GetValidateAttributes(bool isValidate, string displayName, bool isRequire, int minNum, int maxNum, EInputValidateType validateType, string regExp, string errorMessage)
 {
     if (isValidate)
     {
         return
             ($@"isValidate=""{true.ToString().ToLower()}"" displayName=""{displayName}"" isRequire=""{isRequire
                 .ToString().ToLower()}"" minNum=""{minNum}"" maxNum=""{maxNum}"" validateType=""{EInputValidateTypeUtils
                 .GetValue(validateType)}"" regExp=""{regExp}"" errorMessage=""{errorMessage}""");
     }
     return(string.Empty);
 }
Esempio n. 7
0
 public static bool Equals(string typeStr, EInputValidateType type)
 {
     return(Equals(type, typeStr));
 }