public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { if (string.IsNullOrWhiteSpace(keyValuePair.Value)) { throw new NotSupportedException($"Table row column '{keyValuePair.Key}' does not support empty entry."); } if (MapDriver.IsNotSet(keyValuePair.Value)) { return(0M); } var isPercentageRepresentation = keyValuePair.Value.Contains("%"); var stringValue = keyValuePair.Value; if (isPercentageRepresentation) { stringValue = stringValue.Replace("%", "").Trim(); } var value = decimal.Parse(stringValue); if (isPercentageRepresentation) { value *= 0.01M; } return(value); }
public decimal?NullableDecimalTransformation(string value) { if (MapDriver.IsNotSet(value)) { return(null); } return(decimal.Parse(value)); }
public DateTimeOffset TransformDateTimeOffset(string value) { if (MapDriver.IsNotSet(value)) { throw new NotSupportedException("'Empty' entry to 'DateTimeOffset' transformation is not supported."); } return(DateConverter.GetDateOffset(value).Value); }
public static string ReplaceMagicStrings(this string value) { if (MapDriver.IsNotSet(value)) { return(null); } var result = ReplaceMagicStringOfLength(value); result = DateConverter.ReplaceDate(result); return(result); }
private static DateTimeOffset GetValue(KeyValuePair <string, string> keyValuePair) { return(MapDriver.IsNotSet(keyValuePair.Value) ? default : DateConverter.GetDateOffset(keyValuePair.Value).Value); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { return(MapDriver.IsNotSet(keyValuePair.Value) ? (int?)null : int.Parse(keyValuePair.Value.Replace(".", "").Replace(" ", ""))); }
public object Retrieve(KeyValuePair <string, string> keyValuePair, Type targetType, Type propertyType) { return(MapDriver.IsNotSet(keyValuePair.Value) ? null : _retriever.Retrieve(keyValuePair, targetType, propertyType)); }