コード例 #1
0
        /// <summary>
        /// 初始化数据类型
        /// </summary>
        private static void InitDataType(TextBoxConfig config, DataTypeAttribute attribute)
        {
            if (attribute == null)
            {
                return;
            }
            switch (attribute.DataType)
            {
            case DataType.Date:
            case DataType.DateTime:
            case DataType.Time:
                config.IsDatePicker = true;
                break;

            case DataType.MultilineText:
                config.IsTextArea = true;
                break;

            case DataType.EmailAddress:
                config.Email();
                break;

            case DataType.Password:
                config.Password();
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// 初始化电子邮件验证
        /// </summary>
        private static void InitEmail(TextBoxConfig config, MemberInfo member)
        {
            var attribute = member.GetCustomAttribute <EmailAddressAttribute>();

            if (attribute == null)
            {
                return;
            }
            config.Email();
            if (attribute.ErrorMessage.Contains("field is not a valid e-mail address"))
            {
                return;
            }
            config.SetAttribute(UiConst.EmailMessage, attribute.ErrorMessage);
        }