示例#1
0
        private void btnDeletar_Click(object sender, EventArgs e)
        {
            if (dgvLogin.Rows.Count == 0)
            {
            }
            else
            {
                modelLogin.Codigo = dgvLogin.CurrentRow.Cells["codigo"].Value.ToString();
                modelLogin.ID     = dgvLogin.CurrentRow.Cells["id"].Value.ToString();

                var result = MessageBox.Show("O login: "******" será excluido", "Alerta!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (result == DialogResult.OK)
                {
                    controllerLogin.Deletar(modelLogin);
                    if (cbxFiltro.Text == "ADM")
                    {
                        Carregar("Administrador", txtProcurar.Text);
                    }
                    if (cbxFiltro.Text == "VENDEDOR")
                    {
                        Carregar("Vendedor", txtProcurar.Text);
                    }
                    if (cbxFiltro.Text == "ESTOQUISTA")
                    {
                        Carregar("Estoquista", txtProcurar.Text);
                    }
                    if (cbxFiltro.Text == "SUPERVISOR")
                    {
                        Carregar("Supervisor", txtProcurar.Text);
                    }
                    if (cbxFiltro.Text == "TODOS")
                    {
                        CarregarTodos(txtProcurar.Text);
                    }
                    lblExibidosTotal.Text = "Exibidos total: " + dgvLogin.Rows.Count;
                }
            }
        }