Exemple #1
0
        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);
        }
Exemple #2
0
        public void SetStatisticFieldType(string fname, StatisticFieldType sft)
        {
            HybridDictionary ht = HttpContext.Current.Cache["StatisticFieldTypes" + UniqueControlID] as HybridDictionary;

            if (ht == null)
            {
                ht = new HybridDictionary(true);
                HttpContext.Current.Cache["StatisticFieldTypes" + UniqueControlID] = ht;
            }
            ht[fname] = sft;
        }