private void btAlterar_Click(object sender, RoutedEventArgs e) { try { if (dGrid.SelectedItem == null) { return; } int ID = Int32.Parse(((DataRowView)dGrid.SelectedItem).Row["Código"].ToString()); info.cod_cli = ID; DataTable cli = opr.selectCliByID(info); info.cod_cli = (Int32)cli.Rows[0]["Código"]; info.nome_cli = (string)cli.Rows[0]["Nome"]; info.CPF_cli = (string)cli.Rows[0]["CPF"]; info.tel_cli = (string)cli.Rows[0]["Telefone"]; info.cel_cli = (string)cli.Rows[0]["Celular"]; CadCliente cadcli = new CadCliente(info); cadcli.ShowDialog(); dGrid.DataContext = opr.selectCli(); } catch (Exception) { cmb = new CustomMessageBox("Erro interno no SQL."); cmb.ShowDialog(); } }
private void btNovo_Click(object sender, RoutedEventArgs e) { CadCliente cc = new CadCliente(); cc.ShowDialog(); dGrid.DataContext = opr.selectCli(); }