Ejemplo n.º 1
0
        private void btExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo);
                if (d.ToString() == "Yes")
                {
                    DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
                    BLLTipoPagamento bll = new BLLTipoPagamento(cx);
                    bll.Excluir(Convert.ToInt32(txtCodigo.Text));
                    this.LimpaTela();
                    this.alteraBotoes(1);
                }
            }
            catch
            {
                MessageBox.Show("Impossível excluir o registro.\n Pois o mesmo está sendo utilizado em outro local.");
                this.alteraBotoes(3);

            }
        }
Ejemplo n.º 2
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaTipoPagamento f = new frmConsultaTipoPagamento();
            f.ShowDialog();
            f.Dispose();

            if (f.codigo != 0)
            {
                DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
                BLLTipoPagamento bll = new BLLTipoPagamento(cx);
                ModeloTipoPagamento modelo = bll.CarregaModeloTipoPagamento(f.codigo);
                txtCodigo.Text = modelo.TpaCod.ToString();
                txtNome.Text = modelo.TpaNome;
                alteraBotoes(3);
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }
Ejemplo n.º 3
0
        private void btInserir_Click(object sender, EventArgs e)
        {
            this.alteraBotoes(2);

            this.operacao = "inserir";

            DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
            BLLTipoPagamento bll = new BLLTipoPagamento(cx);
            cbxTipoPagamento.DataSource = bll.Localizar("");
            cbxTipoPagamento.DisplayMember = "tpa_nome";
            cbxTipoPagamento.ValueMember = "tpa_cod";

            BLLCliente bllcli = new BLLCliente(cx);
            cbxCliente.DataSource = bllcli.Localizar("");
            cbxCliente.DisplayMember = "cli_nome";
            cbxCliente.ValueMember = "cli_cod";

            BLLProduto bllpro = new BLLProduto(cx);
            cbxProduto.DataSource = bllpro.Localizar("");
            cbxProduto.DisplayMember = "pro_nome";
            cbxProduto.ValueMember = "pro_cod";
        }
Ejemplo n.º 4
0
        private void btSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                //leitura dos dados
                ModeloTipoPagamento modelo = new ModeloTipoPagamento();
                modelo.TpaNome = txtNome.Text;

                //obj para gravar os dados no banco
                DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
                BLLTipoPagamento bll = new BLLTipoPagamento(cx);

                if (this.operacao == "inserir")
                {
                    //cadastrar uma categoria
                    bll.Incluir(modelo);
                    MessageBox.Show("Cadastro efetuado: Código: " + modelo.TpaCod.ToString());

                }
                else
                {
                    //alterar uma categoria
                    modelo.TpaCod = Convert.ToInt32(txtCodigo.Text);
                    bll.Alterar(modelo);
                    MessageBox.Show("Cadastro alterado");
                }
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            catch (SqlException)
            {
                MessageBox.Show("O tipo de pagamento " + txtNome.Text + " já está cadastrado", "Verifique!");
            }
            catch (Exception erro)
            {
                MessageBox.Show(erro.Message);
            }
        }
Ejemplo n.º 5
0
        private void btnAddTipoPag_Click(object sender, EventArgs e)
        {
            frmCadastroTipoPagamento f = new frmCadastroTipoPagamento();
            f.ShowDialog();
            f.Dispose();

            DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
            BLLTipoPagamento bll = new BLLTipoPagamento(cx);
            cbxTipoPagamento.DataSource = bll.Localizar("");
            cbxTipoPagamento.DisplayMember = "tpa_nome";
            cbxTipoPagamento.ValueMember = "tpa_cod";
        }
Ejemplo n.º 6
0
        private void btLocalizar_Click(object sender, EventArgs e)
        {
            frmConsultaVenda f = new frmConsultaVenda();
            f.ShowDialog();
            f.Dispose();

            if (f.codigo != 0)
            {
                itensVenda.Clear();

                DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);

                BLLTipoPagamento blltp = new BLLTipoPagamento(cx);
                cbxTipoPagamento.DataSource = blltp.Localizar("");
                cbxTipoPagamento.DisplayMember = "tpa_nome";
                cbxTipoPagamento.ValueMember = "tpa_cod";

                BLLCliente bllcli = new BLLCliente(cx);
                cbxCliente.DataSource = bllcli.Localizar("");
                cbxCliente.DisplayMember = "cli_nome";
                cbxCliente.ValueMember = "cli_cod";

                BLLProduto bllpro = new BLLProduto(cx);
                cbxProduto.DataSource = bllpro.Localizar("");
                cbxProduto.DisplayMember = "pro_nome";
                cbxProduto.ValueMember = "pro_cod";

                BLLVenda bllvenda = new BLLVenda(cx);
                ModeloVenda modelo = bllvenda.CarregaModeloVenda(f.codigo);

                cbxTipoPagamento.SelectedValue = modelo.TpaCod;
                cbxCliente.SelectedValue = modelo.CliCod;
                txtNumParcelas.Text = Convert.ToString(modelo.VenNparcelas);

                this.codigo = modelo.VenCod;

                BLLItemVenda bll2 = new BLLItemVenda(cx);
                DataTable itens = bll2.Localizar(Convert.ToInt32(modelo.VenCod));
                foreach(DataRow linha in itens.Rows)
                {
                    ModeloItemVenda item = new ModeloItemVenda();
                    item = bll2.CarregaModeloItemVenda(Convert.ToInt32(linha["itemvenda_cod"].ToString()));
                    itensVenda.Add(item);
                }

                dataGridItens.DataSource = null;
                dataGridItens.DataSource = itensVenda;
                dataGridItens.Refresh();

                alteraBotoes(3);

                atualizarTotal();
            }
            else
            {
                this.LimpaTela();
                this.alteraBotoes(1);
            }
            f.Dispose();
        }
Ejemplo n.º 7
0
        private void frmCadastroVenda_Load(object sender, EventArgs e)
        {
            this.alteraBotoes(1);

            DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
            BLLTipoPagamento bll = new BLLTipoPagamento(cx);
            txtTipoPagamento.DataSource = bll.Localizar("");//trás todos os dados
            txtTipoPagamento.DisplayMember = "tpa_nome";// valor que aparece
            txtTipoPagamento.ValueMember = "tpa_cod";//valor que vai ser passado
        }
Ejemplo n.º 8
0
 private void frmCadastroCompra_Load(object sender, EventArgs e)
 {
     this.alteraBotoes(1);
     //combo do tipo de pagamento
     DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
     BLLTipoPagamento bll = new BLLTipoPagamento(cx);
     txtTipoPagamento.DataSource = bll.Localizar("");
     txtTipoPagamento.DisplayMember = "tpa_nome";
     txtTipoPagamento.ValueMember = "tpa_cod";
 }
 private void btnPesquizar_Click(object sender, EventArgs e)
 {
     DALConexao cx = new DALConexao(DadosConexao.StringDeConexao);
     BLLTipoPagamento bll = new BLLTipoPagamento(cx);
     dgvDados.DataSource = bll.Localizar(txtValor.Text);
 }