private void BtnDeletar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(txtID.Text); if (txtID.Text.Trim() == string.Empty) { MessageBox.Show("Selecione Algum Registro"); } else { ProprietarioServico ps = new ProprietarioServico(); if (ps.ProprietariosPorTipo(id).Count() == 0) { tps.Remover(id); LimparCampos(); } else { MessageBox.Show("Este Tipo de Proprietarios possui registros vinculados", "Impossível Excluir"); } } }