예제 #1
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            FormCadastroCat form = new FormCadastroCat();
            IDao            db   = new DAO.CategoriaDao();

            idCategoria             = db.GetId();
            form.lbIdCategoria.Text = "" + idCategoria;

            form.ShowDialog(this);
            Fill();
        }
예제 #2
0
        private void btEdit_Click(object sender, EventArgs e)
        {
            IDao          db        = new DAO.CategoriaDao();
            List <Object> categoria = db.ListAll();


            FormCadastroCat form = new FormCadastroCat();
            int             id   = int.Parse(dgvCategoria.Rows[dgvCategoria.CurrentRow.Index].Cells[0].Value.ToString());

            form.lbIdCategoria.Text = Convert.ToString(id);

            foreach (Modelo.Categoria c in categoria)
            {
                if (c.Id == id)
                {
                    form.txNome.Text = c.Nome;
                }
            }
            form.btCadastrar.Text = "Salvar";
            form.ShowDialog(this);
            Fill();
        }