public void AddField(DataColumn dc, StatisticFieldType sft) { if (dynamicTable[dc.ColumnName] == null || dynamicTable[dc.ColumnName].ShowType == ShowType.HIDDEN) { return; } StatisticField sf = new StatisticField(); sf.Index = dc.Ordinal; if (sft == StatisticFieldType.AUTO) { if (dc.DataType.IsArray || (dc.DataType == typeof(string) && dc.MaxLength > 0x7fff)) { sf.Type = StatisticFieldType.COUNT; } else if (dc.DataType == typeof(string) || dc.DataType == typeof(DateTime) || dc.DataType == typeof(bool)) { sf.Type = StatisticFieldType.DISTINCTCOUNT; } else { sf.Type = StatisticFieldType.SUM; } } else { sf.Type = sft; } Fields.Add(sf); }
public StatisticField Clone() { StatisticField sf = new StatisticField(); sf.Index = Index; sf.Type = Type; foreach (DictionaryEntry de in DistinctCount) { sf.DistinctCount[de.Key] = de.Value; } sf.count = count; sf.sum = sum; sf.first = first; return(sf); }