public void Sort(SortCase sortCase)
        {
            List <DataRow> rows = this.Rows.ToList();

            this.RemoveAll();

            switch (sortCase)
            {
            case SortCase.ByEntityNameAsc: rows = rows.OrderBy(r => r.EntityName).ToList(); break;

            case SortCase.ByEntityNameDesc: rows = rows.OrderByDescending(r => r.EntityName).ToList(); break;

            case SortCase.ByEntityLogicalNameAsc: rows = rows.OrderBy(r => r.EntityLogicalName).ToList(); break;

            case SortCase.ByEntityLogicalNameDesc: rows = rows.OrderByDescending(r => r.EntityLogicalName).ToList(); break;

            case SortCase.ByRoleAsc: rows = rows.OrderBy(r => r.Role).ToList(); break;

            case SortCase.ByRoleDesc: rows = rows.OrderByDescending(r => r.Role).ToList(); break;

            default:
                throw new NotImplementedException("Not implemented sorting case");
            }

            this.LastSortCase = sortCase;
            this.AddRange(rows);
        }
示例#2
0
 public SortData(SortCase sortCase)
 {
     this.SortCase = sortCase;
 }