/// <summary> /// Сортировка списка сотрудников /// </summary> /// <param name="ordered"></param> /// <returns></returns> public List <Employee> SortedBy(EmployeeOrdered ordered = EmployeeOrdered.None) { switch (ordered) { case EmployeeOrdered.BySurname: return(OrderedBySurname()); case EmployeeOrdered.ByPhone: return(OrderedByPhone()); default: return(this); } }
private void dgvEmployees_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { switch (e.ColumnIndex) { case 0: case 1: case 2: _ordered = EmployeeOrdered.BySurname; break; case 3: _ordered = EmployeeOrdered.ByPhone; break; default: _ordered = EmployeeOrdered.None; break; } // просим перерисовать таблицу dgvEmployees.Invalidate(); }