Ejemplo n.º 1
0
        private void BtnInserir_Click(object sender, EventArgs e)
        {
            if (txtProduto.Text != "" && txtLocalEntrega.Text != "" && txtLocalPartida.Text != "" && txtLocalEntrega.Text != "" && DTData.Text != "" && txtValor.Text != "" && txtIDTransportadora.Text != "" && txtIDMotorista.Text != "")
            {
                CAMADAS.BLL.Frete   bllfrete = new CAMADAS.BLL.Frete();
                CAMADAS.MODEL.Frete frete    = new CAMADAS.MODEL.Frete();

                frete.produto        = txtProduto.Text;
                frete.localPartida   = txtLocalPartida.Text;
                frete.localEntrega   = txtLocalEntrega.Text;
                frete.data           = Convert.ToDateTime(DTData.Text);
                frete.valor          = Convert.ToSingle(txtValor.Text);
                frete.transportadora = Convert.ToInt32(txtIDTransportadora.Text);
                frete.motorista      = Convert.ToInt32(txtIDMotorista.Text);

                bllfrete.Insert(frete);

                limparcontrole();

                DGFrete.DataSource = "";
                DGFrete.DataSource = bllfrete.Select();
            }

            else
            {
                MessageBox.Show("TODOS OS ITENS DEVEM SER PREENCHIDOS!", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }