private void PBConfirmar_Click(object sender, EventArgs e) { var resultado = DialogResult; Paciente pac = new Paciente(TBNome.Text.ToString(), TBCPF.Text.ToString(), TBEndereco.Text.ToString(), int.Parse(TBIdade.Text.ToString()), TBSexo.Text.ToString(), TBTelefone.Text.ToString()); string retornoRepository; if (update && mt.VerificaTextBoxesPreenchidas(Controls)) { retornoRepository = repository.UpdatePaciente(pac); MessageBox.Show("Dados alterados com " + retornoRepository, "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); mt.limparTextBoxes(Controls); mt.AlterarEdicaoTextBoxes(Controls, false); TBNome.Enabled = true; TBCPF.Enabled = true; } else if (!update && mt.VerificaTextBoxesPreenchidas(Controls)) { retornoRepository = repository.PersistMedico(pac); resultado = MessageBox.Show("Cadastro Realizado \n " + retornoRepository + "\nDeseja cadastrar uma Anamnese?", "Cadastro", MessageBoxButtons.YesNo, MessageBoxIcon.Information); mt.AlterarEdicaoTextBoxes(Controls, false); mt.limparTextBoxes(Controls); TBNome.Enabled = true; TBCPF.Enabled = true; } else { MessageBox.Show("Dados obrigatórios não foram preenchidos!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (resultado == DialogResult.Yes) { frmAnam = new FRM_Anamnese(TBNome.Text.ToString(), TBCPF.Text.ToString()); mt.limparTextBoxes(Controls); frmAnam.Show(); this.Close(); } }