public void updateList() { try { SpecialOrderManagerMSSQL _selected = new SpecialOrderManagerMSSQL(); dgListAllOrders.ItemsSource = _selected.retrieveAllOrders(); } catch (Exception ex) { MessageBox.Show(" Can't retrieve data grid"); } }
/// <summary> /// Eduardo Colon /// Created: 2019/02/27 /// ///From the grid the user will select and click on the desired order ///a read-only form will open with the selected information. /// /// </summary> private void Deactivate_Click(object sender, RoutedEventArgs e) { if (ListAllOrders.SelectedIndex > -1) { var result = MessageBox.Show("Do you want to cancel the selected order?", "Cancel order", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { var order = (CompleteSpecialOrder)ListAllOrders.SelectedItem; try { _specialOrderLogic.DeactivateSpecialOrder(order.SpecialOrderID); ListAllOrders.ItemsSource = _specialOrderLogic.retrieveAllOrders(); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); } } } else { MessageBox.Show("Please select an order to cancel"); } }