Exemplo n.º 1
0
        private void carregacidade()
        {
            CCidade cc = new CCidade();

            dtcidade             = cc.pesquisar("", "nome");
            cbbcidade.DataSource = dtcidade;
        }
Exemplo n.º 2
0
        private void btnsalvar_Click(object sender, EventArgs e)
        {
            if (ttbnome.Text.Trim() == "")
            {
                MessageBox.Show("Campo nome deve ser preenchido!");
                return;
            }

            CCidade c = new CCidade();

            c.nome = ttbnome.Text;
            c.uf   = ttbuf.Text;


            if (status == 0)
            {
                c.inserir();
            }

            if (status == 1)
            {
                c.atualizar(id);
            }

            limpar();
            leitura();
            MessageBox.Show("Salvo com sucesso!");
        }
Exemplo n.º 3
0
        private void btnpesquisar_Click(object sender, EventArgs e)
        {
            dt = new DataTable();
            CCidade c = new CCidade();

            dt = c.pesquisar(ttbpesquisar.Text, cbbfiltro.Text);
            grid.DataSource = dt;
        }
Exemplo n.º 4
0
        private void cbbcidade_SelectionChangeCommitted(object sender, EventArgs e)
        {
            CCidade   cc = new CCidade();
            DataTable dt = cc.pesquisar(cbbcidade.SelectedValue.ToString(), "id");

            if (dt.Rows.Count > 0)
            {
                ttbuf.Text = dt.Rows[0]["cid_uf"].ToString();
            }
        }
Exemplo n.º 5
0
 private void btnexcluir_Click(object sender, EventArgs e)
 {
     if (id > 0)
     {
         if (MessageBox.Show("Deseja Excluir?", "Excluir!", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             CCidade c = new CCidade();
             if (c.excluir(id))
             {
                 limpar();
                 leitura();
                 MessageBox.Show("Excluído com sucesso!");
             }
             else
             {
                 MessageBox.Show("Não foi possivel efetuar a exclusão!");
             }
         }
     }
     else
     {
         MessageBox.Show("Selecione um Categoria para excluir!");
     }
 }