private void btnCadastrar_Click(object sender, EventArgs e) { if (tipoListagemSelecao == TipoListagem.Aluno) { frmCadastroAluno ca = new frmCadastroAluno(); ca.ShowDialog(); } else { frmCadastroProfessor cp = new frmCadastroProfessor(Escolha.Cadastrar, null); cp.ShowDialog(); pesquisarTodosProfessores(); } }
private void btnAlterar_Click(object sender, EventArgs e) { if (dgvListar.SelectedRows.Count <= 0) { MessageBox.Show("Por favor, selecione uma linha"); } else { Professor professorSelecionado = dgvListar.SelectedRows[0].DataBoundItem as Professor; frmCadastroProfessor cp = new frmCadastroProfessor(Escolha.Alterar, professorSelecionado); cp.ShowDialog(); pesquisarTodosProfessores(); } }