コード例 #1
0
        private void btnIncluir_Click(object sender, EventArgs e)
        {
            if (lblCodigoCliente.Text != "0" && lblCodigoProduto.Text != "0" && lblQuantidade.Text != "0" && txbDescricaoProduto.Text != "")
            {
                ComandosCadVenda comandos = new ComandosCadVenda();
                if (ControleIncluirNull == 1)
                {
                    comandos.IncluirClienteNull(Convert.ToInt32(lblCodigoCliente.Text));
                    ControleIncluirNull = 2;
                }
                ControleVendas controle = new ControleVendas();
                controle.CadatrarItens(Convert.ToInt32(lblCodigoProduto.Text), Convert.ToInt32(lblCodigoVenda.Text), Convert.ToInt32(lblQuantidade.Text), Convert.ToDouble(lblValorUnitario.Text));

                comandos.ConsultarCodigoItem();
                valor            = Convert.ToDouble(lblValorTotal.Text);
                Subtotal        += valor;
                lblSubTotal.Text = Subtotal.ToString();
                valor            = 0;
                dgGrideItens.Rows.Add(Convert.ToString(comandos.codigoItem), lblQuantidade.Text, lblCodigoProduto.Text, txbDescricaoProduto.Text, "R$ " + lblValorUnitario.Text, lblValorTotal.Text);
                Total = Subtotal;
                Limpar();
            }
            else
            {
                MessageBox.Show("Selecione o cliente e um produto na tabela !!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            contadorMais  = 0;
            ContadorMenos = 500;
        }