예제 #1
0
        private void ShowUC()
        {
            if (listaUsers.Items.Count == 0 | currentUC < 0)
            {
                return;
            }

            labelNome.Visible         = false;
            nomeAluno.Visible         = false;
            labelEmail.Text           = "Ano Formacao";
            labelIdade.Text           = "Avaliacao";
            labelCurso.Visible        = false;
            idCursoAluno.Visible      = false;
            labelnmec2.Text           = "ID";
            labelnome2.Text           = "Ano Formacao";
            labelNMEC_TUTOR.Text      = "ID_Horario";
            labelNMEC.Text            = "UC";
            regimeEstudoAluno.Visible = false;
            idBibliotecaAluno.Visible = false;
            labelRegime.Visible       = false;
            labelHorario.Visible      = false;
            labelBiblio.Visible       = false;
            passAluno.Visible         = false;
            idHorarioAluno.Visible    = false;

            UC uc = new UC();

            uc                  = (UC)listaUsers.Items[currentUC];
            nmecAluno.Text      = uc.ID_UC.ToString();
            emailAluno.Text     = uc.AnoFormacao.ToString();
            idadeAluno.Text     = uc.ID_Aval.ToString();
            nmecTutorAluno.Text = uc.ID_Horario.ToString();
        }
예제 #2
0
        private void listaUC()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = BDconnection.getConnection();

            cmd.CommandText = "EXEC SAA.UCS_DO_HORARIO @ID_Horario";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

            SqlDataReader reader = cmd.ExecuteReader();

            listaUsers.Items.Clear();

            while (reader.Read())
            {
                UC uc = new UC();
                uc.ID_UC       = (int)reader["ID_UC"];
                uc.AnoFormacao = reader["AnoFormacao"].ToString();
                uc.ID_Horario  = (int)reader["ID_Horario"];
                uc.ID_Aval     = (int)reader["ID_Aval"];

                listaUsers.Items.Add(uc);
            }
            BDconnection.getConnection().Close();

            currentUC = 0;
            ShowUC();
        }
예제 #3
0
        private void comboBoxHorarios_SelectedIndexChanged(object sender, EventArgs e)
        {
            listaUsers.Visible = true;
            labelnmec2.Visible = true;
            labelnome2.Visible = true;

            foreach (Control ctrl in Controls)
            {
                if (ctrl is TextBoxBase)
                {
                    ctrl.Text = String.Empty;
                }
            }
            if ((String)comboBoxHorarios.SelectedItem == "Aluno")
            {
                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = BDconnection.getConnection();

                cmd.CommandText = "EXEC SAA.ALUNOS_DO_HORARIO @ID_Horario";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

                SqlDataReader reader = cmd.ExecuteReader();
                listaUsers.Items.Clear();

                while (reader.Read())
                {
                    Aluno A = new Aluno();
                    A.Nome          = reader["Nome"].ToString();
                    A.NMEC          = reader["NMEC"].ToString();
                    A.Email         = reader["Email"].ToString();
                    A.RegimeEstudo  = reader["RegimeEstudo"].ToString();
                    A.ID_Horario    = reader["ID_Horario"].ToString();
                    A.ID_Biblioteca = reader["ID_Biblioteca"].ToString();
                    A.ID_Curso      = reader["ID_Curso"].ToString();
                    A.NMEC_Tutor    = reader["NMEC_Tutor"].ToString();
                    A.Idade         = reader["Idade"].ToString();

                    listaUsers.Items.Add(A);
                }
                BDconnection.getConnection().Close();

                currentAluno = 0;
                ShowAluno();
            }
            if ((String)comboBoxHorarios.SelectedItem == "Professor")
            {
                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = BDconnection.getConnection();

                cmd.CommandText = "EXEC SAA.PROFESSOR_DO_HORARIO @ID_Horario";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

                SqlDataReader reader = cmd.ExecuteReader();
                listaUsers.Items.Clear();

                while (reader.Read())
                {
                    Professor prof = new Professor();
                    prof.Nome        = reader["Nome_Prof"].ToString();
                    prof.TNMEC       = (int)reader["TMEC"];
                    prof.Email       = reader["Email"].ToString();
                    prof.numGabinete = (int)reader["Num_Gabinete"];
                    prof.ID_Horario  = (int)reader["ID_Horario"];
                    prof.ID_Dep      = (int)reader["ID_Dep"];

                    listaUsers.Items.Add(prof);
                }
                BDconnection.getConnection().Close();

                currentProfessor = 0;
                ShowProfessor();
            }

            if ((String)comboBoxHorarios.SelectedItem == "Turma")
            {
                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = BDconnection.getConnection();

                cmd.CommandText = "EXEC SAA.TURMAS_DO_HORARIO @ID_Horario";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

                SqlDataReader reader = cmd.ExecuteReader();
                listaUsers.Items.Clear();

                while (reader.Read())
                {
                    Turma turma = new Turma();
                    turma.ID_turma   = (int)reader["ID_Turma"];
                    turma.TNMEC      = (int)reader["TNEMC"];
                    turma.ID_Horario = (int)reader["ID_Horario"];
                    turma.AnoLectivo = (int)reader["AnoLectivo"];

                    listaUsers.Items.Add(turma);
                }
                BDconnection.getConnection().Close();

                currentTurma = 0;
                ShowTurma();
            }

            if ((String)comboBoxHorarios.SelectedItem == "UC")
            {
                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = BDconnection.getConnection();

                cmd.CommandText = "EXEC SAA.UCS_DO_HORARIO @ID_Horario";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

                SqlDataReader reader = cmd.ExecuteReader();
                listaUsers.Items.Clear();

                while (reader.Read())
                {
                    UC uc = new UC();
                    uc.ID_UC       = (int)reader["ID_UC"];
                    uc.AnoFormacao = reader["AnoFormacao"].ToString();
                    uc.ID_Horario  = (int)reader["ID_Horario"];
                    uc.ID_Aval     = (int)reader["ID_Aval"];

                    listaUsers.Items.Add(uc);
                }
                BDconnection.getConnection().Close();

                currentUC = 0;
                ShowUC();
            }
        }