Exemple #1
0
        private void BtnDeletar_Click(object sender, EventArgs e)
        {
            int           id  = Convert.ToInt32(txtID.Text);
            AnimalServico ans = new AnimalServico();

            if (txtID.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Selecione Algum Registro");
            }
            else
            {
                if (ans.AnimaisPorProprietario(id).Count() == 0)
                {
                    ps.Remover(id);
                    LimparCampos();
                }
                else
                {
                    MessageBox.Show("Este Proprietario está vinculado a outros registros", "Impossível Excluir");
                }
            }
        }