示例#1
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            string msg;

            if (lblIdVenda.Text != string.Empty)
            {
                msg = "Confirma Remoção de Venda " + lblIdVenda.Text + "?";
                DialogResult resp;
                resp = MessageBox.Show(msg, "Remoção", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                if (resp == DialogResult.Yes)
                {
                    int id = Convert.ToInt32(lblIdVenda.Text);
                    Camadas.BLL.Venda   bllVenda = new Camadas.BLL.Venda();
                    Camadas.Model.Venda venda    = new Camadas.Model.Venda();
                    venda.Id = id;
                    bllVenda.Delete(venda);
                    dgvVenda.DataSource = "";
                    dgvVenda.DataSource = bllVenda.Select();
                }
            }
            else
            {
                msg = "Não há Venda para remoção...";
                MessageBox.Show(msg, "Venda", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            LimparControlesVenda();
            HabilitarControlesVenda(false);
        }
示例#2
0
        private void btnGrvar_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(lblIdVenda.Text);

            string msg = "";

            if (id == -1)
            {
                msg = "Confirma Inclusão de venda?";
            }
            else
            {
                msg = "Confirma Atualização de Venda?";
            }

            DialogResult resp;

            resp = MessageBox.Show(msg, "Gravar", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            if (resp == DialogResult.Yes)
            {
                venda.Cliente        = Convert.ToInt32(txtIdCliente.Text);
                venda.Funcionario    = Convert.ToInt32(txtIdFuncionario.Text);
                venda.DataVenda      = dtpVenda.Value;
                venda.DataVencimento = dtpVencimento.Value;
                venda.DataPagamento  = dtpPagamento.Value;

                if (id == -1)
                {
                    bllVenda.Insert(venda);
                }
                else
                {
                    venda.Id = id;
                    bllVenda.Update(venda);
                }
            }
            dgvVenda.DataSource = "";
            dgvVenda.DataSource = bllVenda.Select();
            LimparControlesVenda();
            HabilitarControlesVenda(false);
        }
示例#3
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();
        }