public static bool IsNa(this ICustomFieldInfo customFieldValue, object value) { switch (customFieldValue.FieldType) { case FieldTypeEnum.Number: return(value.MaybeAs <decimal?>().Select(x => x == Decimal.MinValue).GetOrDefault()); case FieldTypeEnum.Date: return(value.MaybeAs <DateTime?>().Select(x => x == DateMinValue).GetOrDefault()); case FieldTypeEnum.Text: return(value.MaybeAs <string>().Select(x => x == TextNaValue).GetOrDefault()); } return(false); }
public static object GetNaValue(this ICustomFieldInfo customField) { object naValue = null; switch (customField.FieldType) { case FieldTypeEnum.Text: naValue = TextNaValue; break; case FieldTypeEnum.CheckBox: naValue = false; break; case FieldTypeEnum.Date: naValue = DateMinValue; break; case FieldTypeEnum.Number: naValue = Double.NaN; break; } return(naValue); }