コード例 #1
0
        private void btnMatricular_Click(object sender, EventArgs e)
        {
            Aluno aluno = new Aluno();

            aluno.ObterPorId(Convert.ToInt32(cmbAluno.SelectedValue));

            Curso curso = new Curso();

            curso.ObterPorId(Convert.ToInt32(cmbCurso.SelectedValue));

            Matricula matricula = new Matricula();

            matricula.Inserir(aluno, curso, Program.usuarioLogado);

            MessageBox.Show("Matrícula realizada com sucesso.");
            FrmMatricula_Load(sender, e);
        }
コード例 #2
0
        private void FrmMatricula_Load(object sender, EventArgs e)
        {
            // prreenche o Datagrid com os dados da relações das matriculas ativas ()
            dgvMatricula.Rows.Clear();
            Matricula matricula = new Matricula();
            //var dr = matricula.ListarAtivas();
            DataTable dt = new DataTable();
            //dt.Load(matricula.ListarAtivas());
            //dgvMatricula.DataSource = dt;
            var dr = matricula.ListarAtivas();
            int i  = 0;

            while (dr.Read())
            {
                dgvMatricula.Rows.Add();
                dgvMatricula.Rows[i].Cells[0].Value = dr.GetValue(0);
                dgvMatricula.Rows[i].Cells[1].Value = dr.GetValue(1);
                dgvMatricula.Rows[i].Cells[2].Value = dr.GetValue(2);
                dgvMatricula.Rows[i].Cells[3].Value = dr.GetValue(3);
                i++;
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // prreenche o Datagrid com os dados das matriuclas ativas ()
            dgvRelacoes.Rows.Clear();
            Matricula matricula = new Matricula();
            DataTable dt        = new DataTable();
            var       dr        = matricula.ListarRelacoesAtivas();
            int       i         = 0;

            while (dr.Read())
            {
                dgvRelacoes.Rows.Add();
                dgvRelacoes.Rows[i].Cells[0].Value = dr.GetValue(0);
                dgvRelacoes.Rows[i].Cells[1].Value = dr.GetValue(1);
                dgvRelacoes.Rows[i].Cells[2].Value = dr.GetValue(2);
                dgvRelacoes.Rows[i].Cells[3].Value = dr.GetValue(3);
                dgvRelacoes.Rows[i].Cells[4].Value = dr.GetValue(4);
                dgvRelacoes.Rows[i].Cells[5].Value = dr.GetValue(5);
                dgvRelacoes.Rows[i].Cells[6].Value = dr.GetValue(6);
                dgvRelacoes.Rows[i].Cells[7].Value = dr.GetValue(7);
                dgvRelacoes.Rows[i].Cells[8].Value = dr.GetValue(8);
                i++;
            }
        }