private void List() { //SqlConnection con = ConnectionHelper.GetConnection(); using (SqlConnection sc = ConnectionHelper.GetConnection()) { sc.Open(); string sql = "Select * FROM Encomendas as E JOIN Fornecedor as F ON E.nif_fornecedor=F.nif"; SqlCommand com = new SqlCommand(sql, sc); using (SqlDataAdapter adapter = new SqlDataAdapter(com)) { DataTable dt = new DataTable(); adapter.Fill(dt); dataGrid.ItemsSource = dt.DefaultView; DataGridTextColumn qtd = new DataGridTextColumn(); Encomenda enc = new Encomenda(); int qtt = enc.getQuatidade(); qtd.Binding = new Binding(Convert.ToString(qtt)); qtd.Header = "Quantidade"; dataGrid.Columns.Add(qtd); } } }
private void encomendaFornecedor_Click(object sender, RoutedEventArgs e) { Encomenda encomenda = new Encomenda(); this.NavigationService.Navigate(encomenda); }