public OrdersView() { InitializeComponent(); Connection connection = new Connection("ConnectionFile.xml"); OrdersSql ordersSql = new OrdersSql(connection.EstablishSqlConnection(), nameTextBox.Text); ordersDataGrid.ItemsSource = ordersSql.GetAllOrders().DefaultView; }
private void searchBuuton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Connection connection = new Connection("ConnectionFile.xml"); if (idTextBox.Text.Length > 0) { OrdersSql ordersSql = new OrdersSql(connection.EstablishSqlConnection(), Int32.Parse(idTextBox.Text)); ordersDataGrid.ItemsSource = ordersSql.GetOrdersById().DefaultView; } else { OrdersSql ordersSql = new OrdersSql(connection.EstablishSqlConnection(), nameTextBox.Text); ordersDataGrid.ItemsSource = ordersSql.GetOrdersByName().DefaultView; } }