예제 #1
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (txtId.Text != "-1" && txtCategoria.Text != "")
            {
                CAMADAS.MODEL.Categorias categoria    = new CAMADAS.MODEL.Categorias();
                CAMADAS.BLL.Categorias   bllCategoria = new CAMADAS.BLL.Categorias();

                categoria.id_categoria   = Convert.ToInt32(txtId.Text);
                categoria.desc_categoria = txtCategoria.Text;
                bllCategoria.Update(categoria);
                dgvCategorias.DataSource = "";
                dgvCategorias.DataSource = bllCategoria.Select();
                limparControles();
            }
            else
            {
                MessageBox.Show("Preencha algum nome para a Categoria, para edita-la.");
            }
        }