public static double ParseDouble(string doubleAsString, IFormatProvider formatProvider, EpmChartAggregateType aggregateType) { return(ParseDouble(doubleAsString, formatProvider, aggregateType, false)); }
public static double ParseDouble(string doubleAsString, IFormatProvider formatProvider, EpmChartAggregateType aggregateType, Boolean isCurrency) { var returnValue = 0D; try { if (aggregateType == EpmChartAggregateType.Average) { returnValue = double.Parse(doubleAsString, formatProvider); } else { returnValue = Convert.ToDouble(doubleAsString, formatProvider); } } catch (OverflowException) { // Don't do anything, the value couldn't be converted. } catch (FormatException) { // Don't do anything, the value couldn't be converted. } if (isCurrency) { returnValue = Math.Round(returnValue * 100); } return(returnValue); }
private double GetCleanNumberValue(string toString) { var cleanString = toString.Replace("$", "").Replace("%", ""); return(ChartHelper.ParseDouble(cleanString, providerEn, EpmChartAggregateType.GetByName(PropChartAggregationType))); }