Example #1
0
        /// <summary>
        /// 根据统计类型返回统计值
        /// </summary>
        /// <param name="statisticsResults"></param>
        /// <param name="eType">统计值类型</param>
        /// <returns></returns>
        private static double StatisticsByType(IStatisticsResults statisticsResults, EStatisticsType eType)
        {
            switch (eType)
            {
            case EStatisticsType.Count: return(statisticsResults.Count);

            case EStatisticsType.Maximum: return(statisticsResults.Maximum);

            case EStatisticsType.Mean: return(statisticsResults.Mean);

            case EStatisticsType.Minimum: return(statisticsResults.Minimum);

            case EStatisticsType.Sum: return(statisticsResults.Sum);

            case EStatisticsType.StandardDeviation: return(statisticsResults.StandardDeviation);

            default: throw new NotImplementedException();
            }
        }
Example #2
0
        /// <summary>
        /// 获得字段统计值
        /// </summary>
        /// <param name="table">统计的表格</param>
        /// <param name="fieldName">统计的字段</param>
        /// <param name="whereClause">统计条件</param>
        /// <param name="eType">统计值类型</param>
        /// <returns></returns>
        public static double Statistics(this ITable table, string fieldName, string whereClause, EStatisticsType eType)
        {
            IStatisticsResults statisticsResults = Statistics(table, fieldName, whereClause);

            return(StatisticsByType(statisticsResults, eType));
        }