コード例 #1
0
 private void frmAlunos_Load(object sender, EventArgs e)
 {
     dt = ClsAlunos.listar();
     dgvAlunos.DataSource = dt;
     //dgvAlunos.DataSource = ClsAlunos.listar();
     //MessageBox.Show(ClsAlunos.cont.ToString());
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
        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();
        }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 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();
 }
コード例 #7
0
        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
コード例 #8
0
        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 = "";
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
 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();
     }
 }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
 private void btnListarTodos_Click(object sender, EventArgs e)
 {
     dt = ClsAlunos.listar();
     dgvAlunos.DataSource = dt;
     txtNomeAluno.Clear();
 }
コード例 #13
0
 private void btnPesquisar_Click(object sender, EventArgs e)
 {
     dgvAlunos.DataSource = ClsAlunos.pesquisar(txtNomeAluno.Text);
 }
コード例 #14
0
 private void carregarDataGrid()
 {
     dt = ClsAlunos.listar();
     dgvAlunos.DataSource = dt;
 }
コード例 #15
0
 private void frmAlunos_Load(object sender, EventArgs e)
 {
     dt = ClsAlunos.listar();
     dgvAlunos.DataSource = dt;
 }
コード例 #16
0
 public frmAlunos()
 {
     InitializeComponent();
     dt = ClsAlunos.listar();
     dgvAlunos.DataSource = dt;
 }