private void Button_Click(object sender, RoutedEventArgs e) { try { CadastroDal.CriarBancoSQLite(); btnCriarBancoDados.IsEnabled = false; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void btnCriarTabela_Click(object sender, EventArgs e) { try { CadastroDal.CriarTabelaSQlite(); btnCriarTabela.Enabled = false; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void ExibirDados() { try { DataTable dt = new DataTable(); dt = CadastroDal.GetClientes(); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void ExibirDados() { try { DataTable dt = new DataTable(); dt = CadastroDal.GetClientes(); dgvDados.DataContext = dt; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void btnExcluirDados_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtID.Text)) { MessageBox.Show("Informe o ID do cliente a ser Excluído"); return; } try { int codigo = Convert.ToInt32(txtID.Text); CadastroDal.Delete(codigo); ExibirDados(); LimpaDados(); } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void btnLocalizarDados_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtID.Text)) { MessageBox.Show("Informe o ID do cliente a ser Localizado"); return; } try { DataTable dt = new DataTable(); int codigo = Convert.ToInt32(txtID.Text); dt = CadastroDal.GetCliente(codigo); dataGridView1.DataSource = dt; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void Button_Click_6(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtID.Text)) { MessageBox.Show("Informe o ID do cliente a ser Localizado"); return; } try { DataTable dt = new DataTable(); int codigo = Convert.ToInt32(txtID.Text); dt = CadastroDal.GetCliente(codigo); dgvDados.DataContext = dt; } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void btnAtualizarDados_Click(object sender, EventArgs e) { if (!Valida()) { MessageBox.Show("Informe os dados cliente a atualizar"); return; } try { Cliente cli = new Cliente(); cli.Id = Convert.ToInt32(txtID.Text); cli.Nome = txtNome.Text; cli.Telefone = txtTelefone.Text; CadastroDal.Update(cli); ExibirDados(); } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { if (!Valida()) { MessageBox.Show("Informe os dados cliente a incluir"); return; } try { Cliente cli = new Cliente(); cli.Id = Convert.ToInt32(txtID.Text); cli.Nome = txtNome.Text; cli.Telefone = txtTelefone.Text; CadastroDal.Add(cli); ExibirDados(); LimpaDados(); } catch (Exception ex) { MessageBox.Show("Erro : " + ex.Message); } }