/// <summary> /// Ocorre ao clicar em incluir novo telefone na agenda. /// </summary> private void opçãoIncluirTelefone_Click(object sender, System.EventArgs e) { bool cadastrarOutro = true; while (cadastrarOutro) { Telefone dlg = new Telefone(); if (dlg.ShowDialog(this) == DialogResult.OK) { try { Registro novo = new Registro(dlg.Nome, dlg.TelFixo, dlg.TelCelular, dlg.TelOutro, dlg.Cidade, dlg.Estado); if (Registro.VerificarExistência(novo.Nome)) MessageBox.Show("Este nome já está cadastrado", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); else { novo.Cadastrar(); CriarLinha(novo); } } catch (Exception erro) { Acesso.Comum.Usuários.UsuárioAtual.RegistrarErro(erro); MessageBox.Show("Não foi possível concluir sua operação!", "Agenda de telefones", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else cadastrarOutro = false; dlg.Dispose(); } }