예제 #1
0
        /// <summary>
        /// Get Measure Value
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="measure"></param>
        /// <returns></returns>
        public decimal GetValue(PivotHeaderCell <T> row, PivotHeaderCell <T> col, PivotMeasure <T> measure)
        {
            var query     = __source.AsQueryable();
            var paramCell = new List <PivotHeaderCell <T> >();

            if (row != null)
            {
                var current = row;
                while (current != null)
                {
                    paramCell.Add(current);
                    current = current.Parent;
                }
            }
            if (col != null)
            {
                var current = col;
                while (current != null)
                {
                    paramCell.Add(current);
                    current = current.Parent;
                }
            }
            foreach (var item in paramCell)
            {
                query = query.Where(t => item.Column.EqualsExpression(t, item.LeadObject));
            }
            return(measure.aggregate(query.Select(t => measure.ValueGetter(t))));
        }
예제 #2
0
 /// <summary>
 /// Get Measure Value
 /// </summary>
 /// <param name="row"></param>
 /// <param name="col"></param>
 /// <param name="measure"></param>
 /// <returns></returns>
 public decimal this[PivotHeaderCell <T> row, PivotHeaderCell <T> col, PivotMeasure <T> measure] {
     get {
         return(GetValue(row, col, measure));
     }
 }