private void ListaFuncionarios_CellContentClick(object sender, DataGridViewCellEventArgs e) { DAL.Usuario d = new DAL.Usuario(); if (e.ColumnIndex == 0) { d.Deletar(Convert.ToInt32(ListaFuncionarios.CurrentRow.Cells[2].Value.ToString())); MessageBox.Show("Campos Deletados"); } else if (e.ColumnIndex == 1) { Models.Usuarios.UsuarioLista u = new Models.Usuarios.UsuarioLista(); u.Id = Convert.ToInt32(ListaFuncionarios.CurrentRow.Cells[2].Value.ToString()); u.Nome = ListaFuncionarios.CurrentRow.Cells[3].Value.ToString(); u.CPF = ListaFuncionarios.CurrentRow.Cells[4].Value.ToString(); u.Situacao = ListaFuncionarios.CurrentRow.Cells[5].Value.ToString(); d.AtualizarPorLista(u); MessageBox.Show("Campos Atualizados"); } AtualizarLista(); }
private void button2_Click(object sender, EventArgs e) { DAL.Usuario d = new DAL.Usuario(); d.Deletar(Convert.ToInt32(Id.Text)); MessageBox.Show("Campos Deletados"); AtualizarLista(); }