예제 #1
0
        public object ConvertBack(
            object targetValue,
            Type sourceType,
            object parameter,
            CultureInfo targetCulture)
        {
            Exception exception;

            return(DefaultDataConverter.TryConvert(targetValue, sourceType, targetCulture, CultureInfo.InvariantCulture, out exception));
        }
예제 #2
0
        public object Convert(object sourceValue, Type targetType, object parameter, CultureInfo targetCulture)
        {
            if ((sourceValue == DBNull.Value) || (sourceValue == null))
            {
                return(null);
            }

            Exception exception;

            return(DefaultDataConverter.TryConvert(sourceValue, targetType, CultureInfo.InvariantCulture, targetCulture, out exception));
        }
예제 #3
0
        internal object TryConvertBack(
            object targetValue,
            Type sourceType,
            CultureInfo sourceCulture,
            CultureInfo targetCulture,
            out Exception exception)
        {
            exception = null;

            if ((targetValue == null) || (targetValue == DBNull.Value) ||
                ((sourceType != typeof(string)) && (string.Empty.Equals(targetValue))))
            {
                if (m_sourceSupportsDBNull)
                {
                    return(DBNull.Value);
                }
                else
                {
                    return(null);
                }
            }

            return(DefaultDataConverter.TryConvert(targetValue, sourceType, targetCulture, sourceCulture, out exception));
        }