Ejemplo n.º 1
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            Camadas.BLL.Cliente   bllCli  = new Camadas.BLL.Cliente();
            Camadas.Model.Cliente cliente = new Camadas.Model.Cliente();
            string msg;

            if (lblId.Text != string.Empty)
            {
                msg = "Deseja Remover o Cliente Selecionado?";
                DialogResult resp;
                resp = MessageBox.Show(msg, "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (resp == DialogResult.Yes)
                {
                    cliente.id = Convert.ToInt32(lblId.Text);
                    bllCli.Delete(cliente);
                }
            }
            else
            {
                msg = "Não há registro para remoção...";
                MessageBox.Show(msg, "Remover", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            dgvClientes.DataSource = "";
            dgvClientes.DataSource = bllCli.Select();
            limparCampos();
            Habilitar(false);
        }