Exemple #1
0
        private void cmbVenda_SelectedIndexChanged(object sender, EventArgs e)
        {
            Camadas.BLL.ItemVenda itemV = new Camadas.BLL.ItemVenda();
            int id = Convert.ToInt32(cmbVenda.Text);

            dgvItemVenda.DataSource = itemV.SelectById(id);
        }
Exemple #2
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     LimparControlesItemVenda();
     HabilitarControlesItemVenda(false);
     Camadas.BLL.ItemVenda bllItemVenda = new Camadas.BLL.ItemVenda();
     dgvItemVenda.DataSource = bllItemVenda.SelectByVenda(Convert.ToInt32(lblItemVenda.Text));
 }
Exemple #3
0
        private void btnRemov_Click(object sender, EventArgs e)
        {
            string msg;

            if (lblItemVenda.Text != string.Empty)
            {
                msg = "Confirma Remoção de Itens de Venda " + lblItemVenda.Text + "?";
                DialogResult resp;
                resp = MessageBox.Show(msg, "Remover Item Venda", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (resp == DialogResult.Yes)
                {
                    int id = Convert.ToInt32(lblItemVenda.Text);
                    Camadas.BLL.ItemVenda   bllItemVenda = new Camadas.BLL.ItemVenda();
                    Camadas.Model.ItemVenda itemVenda    = new Camadas.Model.ItemVenda();
                    itemVenda.Id = id;

                    bllItemVenda.Delete(itemVenda);
                    dgvItemVenda.DataSource = "";
                    dgvItemVenda.DataSource = bllItemVenda.Select();
                }
            }
            else
            {
                msg = "Não há Item Venda para remoção...";
                MessageBox.Show(msg, "Item Venda", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #4
0
        private void btnGrav_Click(object sender, EventArgs e)
        {
            Camadas.BLL.ItemVenda   bllItemVenda = new Camadas.BLL.ItemVenda();
            Camadas.Model.ItemVenda itemVenda    = new Camadas.Model.ItemVenda();
            int id = Convert.ToInt32(lblItemVenda.Text);

            string msg = "";

            if (id == -1) // id=-1 (Inclusão) e id!=-1 (atualização)
            {
                msg = "Confirma Inclusão de Item de Locação?";
            }
            else
            {
                msg = "Confirma Atualização de Item de Locação?";
            }

            DialogResult resp;

            resp = MessageBox.Show(msg, "Gravar Item de Locação", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (resp == DialogResult.Yes)
            {
                itemVenda.Venda         = Convert.ToInt32(cmbVenda.Text);
                itemVenda.Produto       = Convert.ToInt32(txtIdProduto.Text);
                itemVenda.Quantidade    = Convert.ToInt32(cmbQuantidade.Text);
                itemVenda.ValorUnitario = Convert.ToSingle(txtValorUnitario.Text);


                if (id == -1)
                {
                    bllItemVenda.Insert(itemVenda);
                    //atualiza a quantidade de produtos após a compra
                    Camadas.BLL.Produto bllProd = new Camadas.BLL.Produto();
                    int num  = Convert.ToInt32(txtIdProduto.Text);
                    int qtde = Convert.ToInt32(txtQuantidade.Text);
                    bllProd.Quantidade(qtde, num);
                }
                else
                {
                    itemVenda.Id = id;
                    bllItemVenda.Update(itemVenda);
                }
            }
            dgvItemVenda.DataSource = "";
            dgvItemVenda.DataSource = bllItemVenda.SelectByVenda(Convert.ToInt32(lblItemVenda.Text));  //atualiza a grid
            LimparControlesItemVenda();
            HabilitarControlesItemVenda(false);
        }
Exemple #5
0
        private void dgvItemVenda_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            List <Camadas.Model.ItemVenda> lstItemVenda = new List <Camadas.Model.ItemVenda>();

            Camadas.BLL.ItemVenda bllItemVenda = new Camadas.BLL.ItemVenda();
            lstItemVenda = bllItemVenda.Select();
            foreach (Camadas.Model.ItemVenda itemVenda in lstItemVenda)
            {
                int   cont  = 0;
                float soma  = 0;
                int   quant = itemVenda.Quantidade;
                float x     = quant * itemVenda.ValorUnitario;

                cont++;
                soma = soma + x;
            }
        }
Exemple #6
0
        private void dgvVenda_DoubleClick(object sender, EventArgs e)
        {
            if (dgvVenda.SelectedRows.Count > 0)
            {
                lblIdVenda.Text = dgvVenda.SelectedRows[0].Cells["id"].Value.ToString();

                cmbCliente.SelectedValue     = Convert.ToInt32(txtIdCliente.Text);
                txtIdCliente.Text            = dgvVenda.SelectedRows[0].Cells["cliente"].Value.ToString();
                cmbFuncionario.SelectedValue = Convert.ToInt32(txtIdFuncionario.Text);
                txtIdFuncionario.Text        = dgvVenda.SelectedRows[0].Cells["funcionario"].Value.ToString();
                dtpVenda.Value      = Convert.ToDateTime(dgvVenda.SelectedRows[0].Cells["dataVenda"].Value.ToString());
                dtpVencimento.Value = Convert.ToDateTime(dgvVenda.SelectedRows[0].Cells["dataVencimento"].Value.ToString());
                dtpPagamento.Value  = Convert.ToDateTime(dgvVenda.SelectedRows[0].Cells["dataPagamento"].Value.ToString());

                Camadas.BLL.ItemVenda bllItemVenda = new Camadas.BLL.ItemVenda();
                int venda = Convert.ToInt32(lblIdVenda.Text);
                dgvItemVenda.DataSource = "";
                dgvItemVenda.DataSource = bllItemVenda.SelectByVenda(venda);
            }
        }
Exemple #7
0
        private void frmVenda_Load(object sender, EventArgs e)
        {
            HabilitarControlesVenda(false);
            HabilitarControlesItemVenda(false);
            LimparControlesVenda();
            LimparControlesItemVenda();

            Camadas.BLL.Venda     bllVenda     = new Camadas.BLL.Venda();
            Camadas.BLL.ItemVenda bllItemVenda = new Camadas.BLL.ItemVenda();

            dgvVenda.DataSource     = bllVenda.Select();
            dgvItemVenda.DataSource = bllItemVenda.Select();

            //combox
            //cliente
            Camadas.BLL.Cliente bllCliente = new Camadas.BLL.Cliente();
            cmbCliente.DisplayMember = "nome";
            cmbCliente.ValueMember   = "id";
            cmbCliente.DataSource    = bllCliente.Select();

            //funcionario
            Camadas.BLL.Funcionario bllFuncionario = new Camadas.BLL.Funcionario();
            cmbFuncionario.DisplayMember = "nome";
            cmbFuncionario.ValueMember   = "id";
            cmbFuncionario.DataSource    = bllFuncionario.Select();

            //venda
            Camadas.BLL.Venda bllVendas = new Camadas.BLL.Venda();
            cmbVenda.DisplayMember = "id";
            cmbVenda.DataSource    = bllVendas.Select();

            //produto
            Camadas.BLL.Produto bllProduto = new Camadas.BLL.Produto();
            cmbProduto.DisplayMember = "nome";
            cmbProduto.ValueMember   = "id";
            cmbProduto.DataSource    = bllProduto.Select();

            txtIdCliente.Text     = cmbCliente.SelectedValue.ToString();
            txtIdFuncionario.Text = cmbFuncionario.SelectedValue.ToString();
        }