Exemple #1
0
        public override object GetGroupValue(object Row)
        {
            var val = Grouper.GetGroupValue(Row);

            if (val == null)
            {
                return(null);
            }
            var s = val.ToString();

            if (s.Length < Letters)
            {
                return(s);
            }
            return(s.Substring(0, Letters));
        }
Exemple #2
0
            void set()
            {
                Groups = null;
                GroupingInfo gi = Owner.groupon;

                if (gi == null)
                {
                    Rows = Owner.List;
                    return;
                }
                if (Owner.GroupSortDirection == SortOrder.None)
                {
                    Groups = new Dictionary <object, GroupRow>();
                }
                else
                {
                    GenericComparer <object> comparer = new GenericComparer <object>();
                    comparer.Descending = Owner.GroupSortDirection == SortOrder.Descending;
                    Groups = new SortedDictionary <object, GroupRow>(comparer);
                }
                foreach (object row in Owner)
                {
                    object   key = gi.GetGroupValue(row);
                    GroupRow gr;
                    if (!Groups.TryGetValue(key, out gr))
                    {
                        gr       = new GroupRow();
                        gr.Value = key;
                        Groups.Add(key, gr);
                    }
                    gr.List.Add(row);
                }

                //var groups = Owner.Cast<object>().GroupBy<object, object>(o => gr.GetGroupValue(o));
                int i = 0;

                Rows = new List <object>(Groups.Count + Owner.BaseCount);
                foreach (GroupRow g in Groups.Values)
                {
                    g.Finalize(i++);
                    Rows.Add(g);
                    foreach (object row in g.Rows)
                    {
                        Rows.Add(row);
                    }
                }
            }
Exemple #3
0
 public override object GetGroupValue(object Row)
 {
     return(GetValue(Grouper.GetGroupValue(Row)));
 }