/// <summary> /// Gets the repeater row count. /// </summary> /// <param name="that">The <see cref="Dictionary{T, V}"/> that acts as the this instance.</param> /// <param name="propertyName">The name of the property to get the total of.</param> /// <returns>A count of repeater rows.</returns> private static object GetRepeaterRowCount(Dictionary<string, object> that, string propertyName) { object[] values = (object[])that.GetApplicationDataValue(typeof(object[]), propertyName); return values.Length.ToString(); }
/// <summary> /// Gets the repeater total value. /// </summary> /// <param name="that">The <see cref="Dictionary{T, V}"/> that acts as the this instance.</param> /// <param name="returnType">The expected type of the return value.</param> /// <param name="propertyName">The name of the property to get the total of.</param> /// <returns>The repeater total value.</returns> private static object GetRepeaterChildTotal(Dictionary<string, object> that, Type returnType, string propertyName) { Type genericListType = typeof(List<>).MakeGenericType(returnType); IList values = (IList)that.GetApplicationDataValue(genericListType, propertyName); List<int> intValues; if (TryParseIntegerList(values, out intValues)) { return intValues.Sum().ToString(); } List<double> doubleValues; if (TryParseDoubleList(values, out doubleValues)) { return doubleValues.Sum().ToString(CultureInfo.InvariantCulture); } return null; }