コード例 #1
0
        public static bool IsDropDown(this PropertyInfo propertyInfo)
        {
            var hasValidValues = AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute))
                ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).ValidValues?.Length > 0
                : false;
            var hasDropDown = AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute))
                ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).IsDropDown
                : false;

            return(hasValidValues || hasDropDown);
        }
コード例 #2
0
        public static string GetLabel(PropertyInfo propertyInfo, Func <string, string> labelFunc, bool includeOptional = true)
        {
            var label = AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute))
                ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).Label
                : null;

            if (label is null)
            {
                if (!(labelFunc is null))
                {
                    label = labelFunc(propertyInfo.Name);
                }
                else
                {
                    label = Labelize(propertyInfo.Name);
                }
            }
コード例 #3
0
 public static int?GetSize(PropertyInfo propertyInfo)
 {
     return(AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute))
         ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).InputLength
         : null);
 }
コード例 #4
0
 public static string GetPlaceHolder(PropertyInfo propertyInfo)
 {
     return(AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute))
         ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).PlaceHolder
         : null);
 }