Esempio n. 1
0
        private void btnSelectCli_Click(object sender, EventArgs e)
        {
            CAMADAS.BLL.Venda   bllVenda = new CAMADAS.BLL.Venda();
            CAMADAS.MODEL.Venda venda    = new CAMADAS.MODEL.Venda();
            int id = Convert.ToInt32(txtCodVenda.Text);

            string msg = "Confirma a seleção de Cliente?";

            DialogResult resp;

            resp = MessageBox.Show(msg, "Selecionar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (resp == DialogResult.Yes)
            {
                venda.idVenda   = id;
                venda.dataVenda = dtpVenda.Value;
                venda.idCli     = Convert.ToInt32(txtCodCli.Text);
                venda.total     = 0;
                if (id == -1)
                {
                    bllVenda.Insert(venda);
                }
                else
                {
                    MessageBox.Show("ERRO AO DAR INSERT", "ERRO", MessageBoxButtons.OK);
                }
            }
            dgvCli.DataSource = "";
            dgvCli.DataSource = bllVenda.Select();
            Limpar();
            Habilitar(false);
        }
Esempio n. 2
0
        private void frmVenda_Load(object sender, EventArgs e)
        {
            Habilitar(false);
            Limpar();
            CAMADAS.BLL.Venda bllvenda = new CAMADAS.BLL.Venda();

            dgvCli.DataSource = bllvenda.Select();

            //carregar ComboBox Cliente
            CAMADAS.BLL.Cliente bllCliente = new CAMADAS.BLL.Cliente();
            cmbCliente.DisplayMember = "nome";
            cmbCliente.ValueMember   = "idCli";
            cmbCliente.DataSource    = bllCliente.Select();

            //carregar Combobox Produto
            CAMADAS.BLL.Produto bllProd = new CAMADAS.BLL.Produto();
            cmbProduto.DisplayMember = "descricao";
            cmbProduto.ValueMember   = "idProd";
            cmbProduto.DataSource    = bllProd.Select();
        }