/// <summary> /// Parses the integer value of a raw cell /// </summary> /// <param name="raw">Raw value as string</param> /// <returns>CellResolverTuple with information about the validity and resolved data</returns> private static CellResolverTuple GetIntValue(string raw) { int iValue; CellResolverTuple t; if (int.TryParse(raw, out iValue)) { t = new CellResolverTuple(true, iValue, typeof(int)); } else { t = new CellResolverTuple(false, 0, typeof(int)); } return(t); }
/// <summary> /// Parses the integer value of a raw cell /// </summary> /// <param name="raw">Raw value as string</param> /// <returns>CellResolverTuple with information about the validity and resolved data</returns> private static CellResolverTuple GetIntValue(string raw) { int iValue; CellResolverTuple t; if (int.TryParse(raw, NumberStyles.Any, CultureInfo.InvariantCulture, out iValue)) { t = new CellResolverTuple(true, iValue, typeof(int)); } else { t = new CellResolverTuple(false, 0, typeof(int)); } return(t); }
/// <summary> /// Parses the numeric (double) value of a raw cell /// </summary> /// <param name="raw">Raw value as string</param> /// <returns>CellResolverTuple with information about the validity and resolved data</returns> private static CellResolverTuple GetNumericValue(string raw) { double dValue; CellResolverTuple t; if (double.TryParse(raw, out dValue)) { t = new CellResolverTuple(true, dValue, typeof(double)); } else { t = new CellResolverTuple(false, 0, typeof(double)); } return(t); }
/// <summary> /// Parses the numeric (double) value of a raw cell /// </summary> /// <param name="raw">Raw value as string</param> /// <returns>CellResolverTuple with information about the validity and resolved data</returns> private static CellResolverTuple GetNumericValue(string raw) { double dValue; CellResolverTuple t; if (double.TryParse(raw, NumberStyles.Any, CultureInfo.InvariantCulture, out dValue)) { t = new CellResolverTuple(true, dValue, typeof(double)); } else { t = new CellResolverTuple(false, 0, typeof(double)); } return(t); }
/// <summary> /// Parses the date (DateTime) value of a raw cell /// </summary> /// <param name="raw">Raw value as string</param> /// <returns>CellResolverTuple with information about the validity and resolved data</returns> private static CellResolverTuple GetDateValue(String raw) { double dValue; CellResolverTuple t; if (double.TryParse(raw, out dValue)) { DateTime date = DateTime.FromOADate(dValue); t = new CellResolverTuple(true, date, typeof(DateTime)); } else { t = new CellResolverTuple(false, new DateTime(), typeof(DateTime)); } return(t); }