private void buttonSortByDate_Click(object sender, EventArgs e) { SortOrderView.Items.Clear(); var list = _ordersManager.SortOrdersByLastUpdate(); foreach (var i in list) { string[] row = { i.MainOrderID.ToString(), _ordersManager.GetUsersFullNameById(i.CustomerID), i.Date.ToString(), _ordersManager.GetStatusName(i.StatusID), i.LastUpdate.ToString(), _ordersManager.GetUsersFullNameById(i.LastStaffUpdated != null ? i.LastStaffUpdated.Value : 0), i.Comments }; var listViewItem = new ListViewItem(row); SortOrderView.Items.Add(listViewItem); } }
private void DateSortButton_Click(object sender, RoutedEventArgs e) { dataGrid.Items.Refresh(); dataGrid.ItemsSource = _orderListView.ToMyOrderList(_orderManager.SortOrdersByLastUpdate()); }