private void frmAlunos_Load(object sender, EventArgs e) { dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; //dgvAlunos.DataSource = ClsAlunos.listar(); //MessageBox.Show(ClsAlunos.cont.ToString()); }
private void txtNomeAluno_KeyPress(object sender, KeyPressEventArgs e) { if ((Keys)e.KeyChar == Keys.Enter) { dt = ClsAlunos.pesquisar(txtNomeAluno.Text); dgvAlunos.DataSource = dt; e.Handled = true; } }
private void btnExcluirAluno_Click(object sender, EventArgs e) { if (MessageBox.Show("Deseja realmente excluir?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { ClsAlunos.cod = Convert.ToInt32(dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"]); ClsAlunos.excluir(ClsAlunos.cod); carregarDataGrid(); } }
private void btnEditar_Click(object sender, EventArgs e) { string nomeAluno, codAluno, dataNasc; dt = ClsAlunos.listar(); nomeAluno = dt.Rows[dgvAlunos.CurrentRow.Index]["nome"].ToString(); codAluno = dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"].ToString(); dataNasc = dt.Rows[dgvAlunos.CurrentRow.Index]["data_nasc"].ToString(); frmAlunosCadastro telaEditar = new frmAlunosCadastro(nomeAluno, codAluno, dataNasc); telaEditar.ShowDialog(); }
private void btnExcluir_Click(object sender, EventArgs e) { if (dgvAlunos.SelectedRows.Count > 0) { ClsAlunos.cod = Convert.ToInt32(dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"]); ClsAlunos.excluir(ClsAlunos.cod); } else { ClsAlunos.cod = Convert.ToInt32(dgvAlunos.Rows[0].Cells[0].Value); ClsAlunos.excluir(ClsAlunos.cod); } }
private void btnEditar_Click(object sender, EventArgs e) { string nomeAluno,codAluno,dataNasc; dt = ClsAlunos.listar(); ClsAlunos aluno = new ClsAlunos(); //aluno.nome=(dt.Rows[dgvAlunos.CurrentRow.Index]["nome"].ToString()); nomeAluno = dt.Rows[dgvAlunos.CurrentRow.Index]["nome"].ToString(); //aluno.id_aluno =Convert.ToInt32(dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"]); codAluno = dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"].ToString(); //aluno.data_nasc = dt.Rows[dgvAlunos.CurrentRow.Index]["data_nasc"].ToString(); dataNasc = dt.Rows[dgvAlunos.CurrentRow.Index]["data_nasc"].ToString(); frmAlunosCadastro telaEditar = new frmAlunosCadastro(nomeAluno, codAluno, dataNasc); telaEditar.ShowDialog(); }
private void carregarComboBox() { dt = ClsAlunos.listar(); cbxAluno.DataSource = dt; //carrega comboBox cbxAluno.DisplayMember = "nome"; cbxAluno.ValueMember = "id_aluno"; cbxAluno.SelectAll(); dd = ClsDisciplinas.listar(); ds = clsSemestres.listar(); cbxSemestre.DataSource = ds; //carrega comboBox cbxSemestre.DisplayMember = "descricao"; cbxSemestre.ValueMember = "id"; }//carrega todos os comboBox
public static DataTable ds; //dataTable para guardar semestres public frmAlunos() { InitializeComponent(); dd = ClsDisciplinas.listar(); dgvDisciplinas.DataSource = dd; dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; ds = clsSemestres.listar(); dgvSemestres.DataSource = ds; comboBox1.DataSource = dd; comboBox1.ValueMember = "id_disciplina"; comboBox1.DisplayMember = ""; }
private void btnExcluir_Click(object sender, EventArgs e) { //StringBuilder codigo = new StringBuilder(); if (dgvAlunos.SelectedRows.Count > 0) { //codigo.Append(dgvAlunos.SelectedRows[0].Cells[0].Value.ToString()); ClsAlunos.cod = Convert.ToInt32(dt.Rows[dgvAlunos.CurrentRow.Index]["id_aluno"]); //ClsAlunos.cod = Convert.ToInt32(dgvAlunos.SelectedRows[0].Cells[0].Value); ClsAlunos.excluir(ClsAlunos.cod); //MessageBox.Show(cod.ToString()); } else { //codigo.Append(dgvAlunos.Rows[0].Cells[0].Value.ToString()); ClsAlunos.cod = Convert.ToInt32(dgvAlunos.Rows[0].Cells[0].Value); ClsAlunos.excluir(ClsAlunos.cod); } }
private void btnSalvar_Click(object sender, EventArgs e) { if (txtNome.Text == "") { MessageBox.Show("O campo Nome não pode estar vazio!"); } else { if (statusForm == eStatusForm.inserir) { try { ClsAlunos aluno = new ClsAlunos(txtNome.Text, dtpDataNasc.Text); ClsAlunos.inserir(aluno.nome, aluno.data_nasc); } catch (Exception) { MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel inserir!"); } } if (statusForm == eStatusForm.update) { try { _nome = txtNome.Text; _data_nasc = dtpDataNasc.Text; ClsAlunos.editar(codAnt, _nome, _data_nasc); } catch (Exception) { MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel editar!"); } } acaoAluno("", false); carregarDataGrid(); } }
private void btnSalvar_Click(object sender, EventArgs e) { if (txtNome.Text == "") { MessageBox.Show("O campo Nome não pode estar vazio!"); } else { if (statusForm == eStatusForm.inserir) { try { ClsAlunos aluno = new ClsAlunos(txtNome.Text, dtpDataNasc.Text); ClsAlunos.inserir(aluno.nome,aluno.data_nasc); } catch (Exception) { MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel inserir!"); } } if (statusForm == eStatusForm.update) { try { _nome = txtNome.Text; _data_nasc = dtpDataNasc.Text; ClsAlunos.editar(codAnt, _nome, _data_nasc); } catch (Exception) { MessageBox.Show(MessageBoxIcon.Error + "Não foi possivel editar!"); } } acaoAluno("", false); carregarDataGrid(); } }
private void btnListarTodos_Click(object sender, EventArgs e) { dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; txtNomeAluno.Clear(); }
private void btnPesquisar_Click(object sender, EventArgs e) { dgvAlunos.DataSource = ClsAlunos.pesquisar(txtNomeAluno.Text); }
private void carregarDataGrid() { dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; }
private void frmAlunos_Load(object sender, EventArgs e) { dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; }
public frmAlunos() { InitializeComponent(); dt = ClsAlunos.listar(); dgvAlunos.DataSource = dt; }