private void frmFabricante_Load(object sender, EventArgs e) { Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); dgvFabricante.DataSource = bllFabricante.Select(); Habilitar(false); pnlPesquisa.Visible = false; }
private void btnFiltrar_Click(object sender, EventArgs e) { if (txtPesquisa.Text != string.Empty) { Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); List <Camadas.Model.Fabricante> lstFabricante = new List <Camadas.Model.Fabricante>(); if (rdbCodigo.Checked) { lstFabricante = bllFabricante.SelectById(Convert.ToInt32(txtPesquisa.Text)); } else if (rdbNome.Checked) { lstFabricante = bllFabricante.SelectByNome(txtPesquisa.Text); } dgvFabricante.DataSource = ""; dgvFabricante.DataSource = lstFabricante; } else { string msg = "Campo Pesquisa esta vazio..."; MessageBox.Show(msg, "Pesquisa", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnRemover_Click(object sender, EventArgs e) { string msg; if (lblId.Text != string.Empty) { msg = "Confirma Remoção do Fabricante " + txtNome.Text + "?"; DialogResult resp; resp = MessageBox.Show(msg, "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (resp == DialogResult.Yes) { int id = Convert.ToInt32(lblId.Text); Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); Camadas.Model.Fabricante fabricante = new Camadas.Model.Fabricante(); fabricante.Id = id; bllFabricante.Delete(fabricante); dgvFabricante.DataSource = ""; dgvFabricante.DataSource = bllFabricante.Select(); } } else { msg = "Não há registro para remoção..."; MessageBox.Show(msg, "Remover", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } limparCampos(); Habilitar(false); }
private void rdbTodos_CheckedChanged(object sender, EventArgs e) { lblPesquisa.Visible = false; txtPesquisa.Visible = false; btnFiltrar.Visible = false; Camadas.BLL.Fabricante bllCliente = new Camadas.BLL.Fabricante(); dgvFabricante.DataSource = ""; dgvFabricante.DataSource = bllCliente.Select(); }
private void RecuperarDadosFabricante() { Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); List <Camadas.Model.Fabricante> lstFabr = new List <Camadas.Model.Fabricante>(); lstFabr = bllFabricante.SelectById(Convert.ToInt32(txtIdFrabr.Text)); if (lstFabr != null) { fabricante = lstFabr[0]; } else { MessageBox.Show("Fornecedor não encontrado"); } }
private void btnGrvar_Click(object sender, EventArgs e) { Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); Camadas.Model.Fabricante fabricante = new Camadas.Model.Fabricante(); int id = Convert.ToInt32(lblId.Text); string msg = ""; if (id == -1) { msg = "Confirma Inclusao dos Dados?"; } else { msg = "Confirma Atualização dos Dados?"; } DialogResult resp; resp = MessageBox.Show(msg, "Gravar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (resp == DialogResult.Yes) { fabricante.Id = id; fabricante.Nome = txtNome.Text; fabricante.CNPJ = txtCnpj.Text; fabricante.Telefone = txtTelefone.Text; fabricante.Endereco = txtEndereco.Text; fabricante.Bairro = txtBairro.Text; fabricante.Cidade = txtCidade.Text; fabricante.UF = txtUf.Text; fabricante.CEP = txtCep.Text; fabricante.Email = txtEmail.Text; if (id == -1) { bllFabricante.Insert(fabricante); } else { bllFabricante.Update(fabricante); } } dgvFabricante.DataSource = ""; dgvFabricante.DataSource = bllFabricante.Select(); limparCampos(); Habilitar(false); }
private void frmProduto_Load(object sender, EventArgs e) { pnlPesquisa.Visible = false; HabilitarControlesProduto(false); LimpaControlesProduto(); Camadas.BLL.Produto bllProduto = new Camadas.BLL.Produto(); dgvProduto.DataSource = bllProduto.Select(); Camadas.BLL.Fornecedor bllFornecedor = new Camadas.BLL.Fornecedor(); cmbNomeForn.DisplayMember = "nome"; cmbNomeForn.ValueMember = "id"; cmbNomeForn.DataSource = bllFornecedor.Select(); Camadas.BLL.Fabricante bllFabricante = new Camadas.BLL.Fabricante(); cmbNomeFabr.DisplayMember = "nome"; cmbNomeFabr.ValueMember = "id"; cmbNomeFabr.DataSource = bllFabricante.Select(); }