Esempio n. 1
0
 public void AddField(string fieldname, int fieldType, bool unique, bool reverse)
 {
     MySorterNode node = new MySorterNode();
     node.Field = new SortField(fieldname, fieldType, reverse);
     node.Unique = unique;
     sortFields.Add(node);
 }
Esempio n. 2
0
        public void SortBy(string field)
        {
            for (int i = 0; i < sortFields.Count; i++)
            {
                MySorterNode node = (MySorterNode)sortFields[i];
                SortField sf = node.Field;
                if (field.Equals(sf.GetField()))
                {
                    if (i == 0)
                    {
                        node.Field = new SortField(sf.GetField(), sf.GetType(), !sf.GetReverse());
                    }
                    sortFields.RemoveAt(i);
                    sortFields.Insert(0, node);

                }
            }
        }
Esempio n. 3
0
        public SortField[] GetSortFields()
        {
            int validcount = 0;
            int count = sortFields.Count; 
            for (int i = 0; i < count; i++)
            {
                MySorterNode node = (MySorterNode)sortFields[i];
                validcount++;
                if (node.Unique)
                {
                    break;
                }
            }

            SortField[] sfs = new SortField[validcount];
            for (int i = 0; i < validcount; i++)
            {
                sfs[i] = ((MySorterNode)sortFields[i]).Field;
            }

            return sfs;
        }