private void BtnSalvar_Click(object sender, EventArgs e) { try { //leitura dos dados AtendimentoDTO ate = new AtendimentoDTO(); ate.Ate_cliente = Convert.ToInt32(ate_clienteTextBox.Text); ate.Ate_animal = Convert.ToInt32(ate_animalComboBox.SelectedValue); // remover depois ate.Ate_medico = Convert.ToInt32(ate_medicoComboBox.SelectedValue); ate.Ate_tipo = Convert.ToInt32(ate_tipoComboBox.SelectedValue); ate.Ate_anamnese = ate_anamneseTextBox.Text; ate.Ate_tratamento = ate_tratamentoTextBox.Text; //obj para gravar dados no bd ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); if (this.operacao == "inserir") /// alterar salvar para inserir { bll.Incluir(ate); MessageBox.Show("Cadastrado com Sucesso: Código: " + ate.Ate_id.ToString()); //this.LimpaTela(); pnInfo.Show(); } else { ate.Ate_id = Convert.ToInt32(ate_idTextBox.Text); bll.Alterar(ate); MessageBox.Show("Cadastrado Alterado com Sucesso: Código: " + ate.Ate_id.ToString()); } this.LimpaTela(); this.AlterarBotoes(1); } //try catch (Exception erro) { MessageBox.Show(erro.Message); } }