示例#1
0
 private void btnCriarBancoDados_Click(object sender, EventArgs e)
 {
     try
     {
         DalHelper.CriarBancoSQLite();
         btnCriarBancoDados.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
示例#2
0
 private void btnCriarTabela_Click(object sender, EventArgs e)
 {
     try
     {
         DalHelper.CriarTabelaSQlite();
         btnCriarTabela.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
示例#3
0
 private void ExibirDados()
 {
     try
     {
         DataTable dt = new DataTable();
         dt = DalHelper.GetClientes();
         dgvDados.DataSource = dt;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
示例#4
0
 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);
         DalHelper.Delete(codigo);
         ExibirDados();
         LimpaDados();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
示例#5
0
        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 = DalHelper.GetCliente(codigo);
                dgvDados.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
示例#6
0
        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.Email = txtEmail.Text;

                DalHelper.Update(cli);
                ExibirDados();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
示例#7
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (!Valida())
            {
                MessageBox.Show("Informe os dados cliente a incluir");
                return;
            }
            try
            {
                Cliente cli = new Cliente();
                cli.Id    = Convert.ToInt32(textBox1.Text);
                cli.Nome  = textBox2.Text;
                cli.Email = textBox3.Text;

                DalHelper.Add(cli);

                ExibirDados();
                LimpaDados();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
示例#8
0
 private void button2_Click(object sender, EventArgs e)
 {
     DalHelper.CriarTabelaSQlite();
     button2.Enabled = false;
 }
示例#9
0
 private void button1_Click(object sender, EventArgs e)
 {
     DalHelper.CriarBancoSQLite();
     button1.Enabled = false;
 }