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); }
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); } }
public static int?GetSize(PropertyInfo propertyInfo) { return(AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute)) ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).InputLength : null); }
public static string GetPlaceHolder(PropertyInfo propertyInfo) { return(AeLabelAttribute.IsDefined(propertyInfo, typeof(AeLabelAttribute)) ? (AeLabelAttribute.GetCustomAttribute(propertyInfo, typeof(AeLabelAttribute)) as AeLabelAttribute).PlaceHolder : null); }