Beispiel #1
0
 protected override ReportColumnMapping FindColumnByFieldName(
     string table,
     string field,
     FieldAggregationMethod aggregationMethod)
 {
     throw new NotImplementedException();
 }
Beispiel #2
0
        public static Aggregate GetAggregate(FieldAggregationMethod aggregationMethod)
        {
            switch (aggregationMethod)
            {
            case FieldAggregationMethod.First:
            case FieldAggregationMethod.Min:
                return(Aggregate.Min);

            case FieldAggregationMethod.Max:
                return(Aggregate.Max);

                break;

            case FieldAggregationMethod.Average:
                return(Aggregate.Avg);

                break;

            case FieldAggregationMethod.Sum:
                return(Aggregate.Sum);

                break;

            case FieldAggregationMethod.Exclude:
                return(Aggregate.None);

                break;

            case FieldAggregationMethod.Bit:
                return(Aggregate.Bit);

                break;

            case FieldAggregationMethod.BitMax:
                return(Aggregate.BitMax);

                break;

            default:
                throw new ArgumentOutOfRangeException("aggregationMethod");
            }
        }
        protected override ReportColumnMapping FindColumnByFieldName(string table, string field, FieldAggregationMethod aggregationMethod)
        {
            var foundTable = (_tableMappings.GetTableFromNameOrAlias(table) ?? table);

            int?transposeKeyValue = null;

            if (foundTable == _transposeStatsTableName)
            {
                transposeKeyValue = int.Parse(table.Split('_')[1]);
            }

            var matchingColumn = FindColumnByFieldName(foundTable, field, aggregationMethod, statTransposeKeyValue: transposeKeyValue);

            return(matchingColumn);
        }
        public virtual ReportColumnMapping FindColumnByFieldName(string table, string field, FieldAggregationMethod aggregationMethod, int?statTransposeKeyValue = null, bool cacheOnly = false)
        {
            var found = ColumnProvider.Find(_constants.DataSourceId, table, field, statTransposeKeyValue, cacheOnly);

            if (found.Count > 1)
            {
                found = found.Where(x => x.FieldAggregationMethod == aggregationMethod).ToList();
                if (found.Count > 1)
                {
                    if (statTransposeKeyValue > 0)
                    {
                        throw new Exception(string.Format("Found more than one column for {0}.{1} (transpose key value: {2})", table, field, statTransposeKeyValue));
                    }
                    throw new Exception(string.Format("Found more than one column for {0}.{1} (aggregation method : {2})", table, field, aggregationMethod));
                }
            }

            return(found.SingleOrDefault());
        }
Beispiel #5
0
 protected abstract ReportColumnMapping FindColumnByFieldName(string table, string field, FieldAggregationMethod aggregationMethod);