public string GetDisplayText(IVariantTableColumn <object> col) { var value = GetValue(col); string displayText = ""; if (value != null) { if (col.Selections != null && col.Selections.Any()) { displayText = Convert.ToString((col.Selections != null && col.Selections.Any()) ? col.Selections.Where(s => s.Value == Convert.ToString(value)).Select(s => s.Text).FirstOrDefault() ?? value : value); } else { if (value.GetType() == typeof(DateTime) && ((DateTime)value).TimeOfDay.TotalMilliseconds == 0) { displayText = ((DateTime)value).ToString("yyyy-MM-dd"); } else if (value.GetType() == typeof(bool)) { displayText = (bool)value ? "Yes" : "No"; } else if (Utilities.IsFloat(value.GetType())) { displayText = Convert.ToDecimal(value).ToString("N1"); } else { displayText = Convert.ToString(value); } } } return(displayText ?? ""); }
public object GetValue(IVariantTableColumn <object> col) { return(col.GetValue(this)); }
public T GetValue <T>(IVariantTableColumn <object> col) { return(col.GetValue <T>(this)); }
public Exception SetValue(IVariantTableColumn <object> col, object value, bool compareWithExistingValue = true) { return(SetValue(col?.PropertyName, value, compareWithExistingValue)); }