private void rbTodos_CheckedChanged(object sender, EventArgs e) { CAMADAS.BLL.CategoriaBLL bllCat = new CAMADAS.BLL.CategoriaBLL(); txtPesquisar.Enabled = false; Pesquisar.Enabled = false; lblInsira.Text = ""; dgvCategoria.DataSource = ""; dgvCategoria.DataSource = bllCat.SelectAll(); }
private void Compra_Load(object sender, EventArgs e) { CAMADAS.BLL.CategoriaBLL bllCat = new CAMADAS.BLL.CategoriaBLL(); cbCategoria.DisplayMember = "categoria"; cbCategoria.ValueMember = "id"; cbCategoria.DataSource = bllCat.SelectAll(); dgvCarrinho.DataSource = new List <CAMADAS.MODEL.Carrinho>(); rbTodos.Checked = true; zerarProduto(); habilitarCliente(false); txtSenha.UseSystemPasswordChar = true; recarregarTabelaProduto(); }
private void dgvProdutos_DoubleClick(object sender, EventArgs e) { CAMADAS.BLL.CategoriaBLL bllCat = new CAMADAS.BLL.CategoriaBLL(); lblIdProduto.Text = dgvProdutos.SelectedRows[0].Cells["id"].Value.ToString(); txtProdutoProduto.Text = dgvProdutos.SelectedRows[0].Cells["produto"].Value.ToString(); txtPrecoProduto.Text = dgvProdutos.SelectedRows[0].Cells["preco"].Value.ToString(); txtEstoqueProduto.Text = dgvProdutos.SelectedRows[0].Cells["quantidadeEstoque"].Value.ToString(); txtCategoriaProduto.Text = bllCat.SelectById(Convert.ToInt32(dgvProdutos.SelectedRows[0].Cells["idCategoria"].Value.ToString()))[0].categoria; Bitmap imagem = new Bitmap(Conexao.getPathImagens() + @"Produtos/" + dgvProdutos.SelectedRows[0].Cells["imagem"].Value.ToString()); pbFotoProduto.Image = imagem; }
private void recarregarTabela() { CAMADAS.BLL.CategoriaBLL catBll = new CAMADAS.BLL.CategoriaBLL(); if (rbTodos.Checked) { dgvCategoria.DataSource = catBll.SelectAll(); } else if (rbId.Checked) { dgvCategoria.DataSource = catBll.SelectById(Convert.ToInt32(txtPesquisar.Text)); } else if (rbDescricao.Checked) { dgvCategoria.DataSource = catBll.SelectByCategoria(txtPesquisar.Text); } }
public Produto() { InitializeComponent(); rbTodos.Checked = true; CAMADAS.BLL.ProdutoBLL bllProd = new CAMADAS.BLL.ProdutoBLL(); CAMADAS.BLL.CategoriaBLL catBll = new CAMADAS.BLL.CategoriaBLL(); dgvProdutos.DataSource = ""; dgvProdutos.DataSource = bllProd.SelectAll(); cbCategoria.DisplayMember = "categoria"; cbCategoria.ValueMember = "id"; cbCategoria.DataSource = catBll.SelectAll(); txtPesquisar.Enabled = false; pesquisarBtn.Enabled = false; limparCampos(); desabilitarBotoes(true); desabilitarCampos(); cbCategoria.SelectedItem = null; }
private void btnSalvar_Click(object sender, EventArgs e) { CAMADAS.MODEL.Categoria categoria = new CAMADAS.MODEL.Categoria(); categoria.id = Convert.ToInt32(lblId.Text); categoria.categoria = txtDescricao.Text; CAMADAS.BLL.CategoriaBLL catBll = new CAMADAS.BLL.CategoriaBLL(); if (this.acao.Equals("cadastrar")) { catBll.Insert(categoria); } else if (this.acao.Equals("editar")) { catBll.Update(categoria); } else if (this.acao.Equals("deletar")) { catBll.Delete(categoria); } recarregarTabela(); limparCampos(); }