//recebe os valores para salvar private bool SalvarVenda() { Venda venda = new Venda(); try { //caso os campos estiverem vazios if (txtCliente.Text == "" || txtFrete.Text == "" || cmbFormaPag.Text == "" || txtCodPrazo.Text == "" || txtCodVendedor.Text == "") { MessageBox.Show("Campos com * são obrigatórios o preenchimento"); } else { venda.NomeCliente = txtCliente.Text; venda.Telefone = txtTelefone.Text; venda.LoginFuncionario.CodFuncionario = Convert.ToInt32(txtCodVendedor.Text); venda.DataVenda = Convert.ToDateTime(lblData.Content); venda.FormaPagamento = cmbFormaPag.Text; venda.Frete = Convert.ToDouble(txtFrete.Text); venda.Prazo.CodCondPagamento = Convert.ToInt64(txtCodPrazo.Text); venda.Observacao = txtObservacao.Text; MessageBoxResult salvar = MessageBox.Show("Deseja salvar as informações ?", "Salvar", MessageBoxButton.YesNo); if (salvar == MessageBoxResult.Yes) { vendaBLL = new VendaBLL(); if (ValidaCampos() == true) { vendaBLL.SalvarVenda(venda); BloquearCamposInformativos(); DesbloquearCamposItens(); return(true); } } } } catch (Exception error) { MessageBox.Show("Erro: " + error); } return(false); }