Exemple #1
0
        internal string ValueToString(object o)
        {
            if (mDecimalConv == null)
            {
                mDecimalConv = new ConvertHelpers.DecimalConverter(DecimalSeparator);
                mDoubleConv  = new ConvertHelpers.DoubleConverter(DecimalSeparator);
                mSingleConv  = new ConvertHelpers.SingleConverter(DecimalSeparator);
                mDateConv    = new ConvertHelpers.DateTimeConverter(DateFormat);
            }

            if (o == null)
            {
                return(string.Empty);
            }
            else if (o is DateTime)
            {
                return(mDateConv.FieldToString(o));
            }
            else if (o is Decimal)
            {
                return(mDecimalConv.FieldToString(o));
            }
            else if (o is Double)
            {
                return(mDoubleConv.FieldToString(o));
            }
            else if (o is Single)
            {
                return(mSingleConv.FieldToString(o));
            }
            else
            {
                return(o.ToString());
            }
        }
Exemple #2
0
		internal string ValueToString(object o)
		{
			if (mDecimalConv == null)
			{
				mDecimalConv = new ConvertHelpers.DecimalConverter(DecimalSeparator);
				mDoubleConv = new ConvertHelpers.DoubleConverter(DecimalSeparator);
				mSingleConv = new ConvertHelpers.SingleConverter(DecimalSeparator);
				mDateConv= new ConvertHelpers.DateTimeConverter(DateFormat);
			}
			
			if (o == null)
				return string.Empty;
			else if (o is DateTime)
				return mDateConv.FieldToString(o);
			else if (o is Decimal)
				return mDecimalConv.FieldToString(o);
			else if (o is Double)
				return mDoubleConv.FieldToString(o);
			else if (o is Single)
				return mSingleConv.FieldToString(o);
			else 
				return o.ToString();
			
		}
Exemple #3
0
		internal string ValueToString(object o)
		{
			if (mDecimalConv == null)
			{
				mDecimalConv = new ConvertHelpers.DecimalConverter(DecimalSeparator);
				mDoubleConv = new ConvertHelpers.DoubleConverter(DecimalSeparator);
				mSingleConv = new ConvertHelpers.SingleConverter(DecimalSeparator);
				mDateConv= new ConvertHelpers.DateTimeConverter(DateFormat);
			}
			
			if (o == null)
				return string.Empty;
            else if (o is DateTime)
            {
                if (Convert.ToDateTime(o).Hour == 0 && Convert.ToDateTime(o).Minute == 0)
                    return Convert.ToDateTime(o).ToString(System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern);
                else
                    return mDateConv.FieldToString(o);
            }
            else if (o is Decimal)
                return mDecimalConv.FieldToString(o);
            else if (o is Double)
                return mDoubleConv.FieldToString(o);
            else if (o is Single)
                return mSingleConv.FieldToString(o);
            else
            {
                string stringValue = o.ToString();
                stringValue = stringValue.Replace("\"", "\"\"");
                if (stringValue.Contains(","))
                    stringValue = "\"" + stringValue + "\"";
                return stringValue.ToString();
            }
		}