public static string GetDataFormatStringOrNull(this IBasicObjectExtensionPropertyInfo property) { return(property .Attributes .OfType <DisplayFormatAttribute>() .FirstOrDefault()?.DataFormatString); }
public static DataType?GetDataTypeOrNull(this IBasicObjectExtensionPropertyInfo property) { return(property .Attributes .OfType <DataTypeAttribute>() .FirstOrDefault()?.DataType); }
public static string GetTextInputValueOrNull(this IBasicObjectExtensionPropertyInfo property, object value) { if (value == null) { return(null); } if (TypeHelper.IsFloatingType(property.Type)) { return(value.ToString()?.Replace(',', '.')); } return(value.ToString()); }
public static string GetDateEditInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) { if (property.IsDate()) { return("{0:yyyy-MM-dd}"); } if (property.IsDateTime()) { return("{0:yyyy-MM-ddTHH:mm}"); } return(null); }
public static string GetInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) { var formatString = property.GetDataFormatStringOrNull(); if (!formatString.IsNullOrWhiteSpace()) { return(formatString); } if (property.IsDate()) { return("{0:yyyy-MM-dd}"); } if (property.IsDateTime()) { return("{0:yyyy-MM-ddTHH:mm}"); } return(null); }
public static bool IsDateTime(this IBasicObjectExtensionPropertyInfo property) { return(DateTimeTypes.Contains(property.Type) && !property.IsDate()); }
public static bool IsDate(this IBasicObjectExtensionPropertyInfo property) { return(DateTimeTypes.Contains(property.Type) && property.GetDataTypeOrNull() == DataType.Date); }
public static T GetInputValueOrDefault <T>(this IBasicObjectExtensionPropertyInfo property, object value) { if (value == null) { return(default);