Exemple #1
0
        /////////////////////////////////////////////



        private void FormProf_Turmas_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBoxT.Items.Count == 0)
            {
                return;
            }
            String turmaSelected = (String)comboBoxT.SelectedItem;
            //MessageBox.Show(depSelected);  //TROCAR AQU!!!
            SqlCommand    cmd    = new SqlCommand("select * from SAA.PROFESSORES_TURMA_Y (" + Int32.Parse(turmaSelected) + ") ", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox1.Items.Clear();
            while (reader.Read())
            {
                turmaAluno B = new turmaAluno();

                B.ID_turma  = (int)reader["ID_turma"];
                B.TNMEC     = (int)reader["TNEMC"];
                B.nome_Prof = reader["Nome_Prof"].ToString();
                B.numGab    = (int)reader["Num_Gabinete"];
                B.Email     = reader["Email"].ToString();

                listBox1.Items.Add(B);
            }
            BDconnection.getConnection().Close();
            currentA = 0;
            ShowTurma_Prof();
        }
Exemple #2
0
        private void ListarRegistos()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = BDconnection.getConnection();

            cmd.CommandText = "SELECT * FROM SAA.REGISTOS_DO_NMEC ( @NMEC )";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@NMEC", nmecAluno.Text);

            SqlDataReader reader = cmd.ExecuteReader();

            listRegistos.Items.Clear();

            while (reader.Read())
            {
                Registo R = new Registo();
                R.ID_Registo = reader["ID_Registo"].ToString();
                R.NMEC       = reader["NMEC"].ToString();
                R.ID_UC      = reader["ID_UC"].ToString();
                R.ID_Aval    = reader["ID_Aval"].ToString();

                listRegistos.Items.Add(R);
            }
            BDconnection.getConnection().Close();

            currentRegisto = 0;
            ShowRegisto();
        }
Exemple #3
0
        private void listaTurma()
        {
            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();
        }
Exemple #4
0
        //LOAD_LISTBOX dos professores
        private void FormProf_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand    cmd    = new SqlCommand("SELECT * FROM SAA.PROFESSOR", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox1.Items.Clear();

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

                //String prof = reader["Nome_Prof"].ToString() + "  " + reader["TMEC"];
                listBox1.Items.Add(A);
            }
            BDconnection.getConnection().Close();
            currentProf = 0;
            ShowProf();
        }
        //para a listBox
        public void showTurmasProf()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBox1.Items.Count == 0)
            {
                return;
            }
            String profSelected = (String)comboBox1.SelectedItem;
            //MessageBox.Show(depSelected);
            SqlCommand    cmd    = new SqlCommand("select * from SAA.TURMAS_POR_PROFESSOR ('" + profSelected + "') ", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox1.Items.Clear();

            while (reader.Read())
            {
                ProfTurma A = new ProfTurma();

                A.ID_turma = (int)reader["ID_turma"];
                A.TNMEC    = (int)reader["TMEC"];
                A.Nome     = reader["Nome_Prof"].ToString();
                A.Email    = reader["Email"].ToString();

                listBox1.Items.Add(A);
            }
            BDconnection.getConnection().Close();
            currentProfTurma = 0;
            ShowTurma_Prof();
        }
Exemple #6
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();
        }
Exemple #7
0
        private void FormtipoSala_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBoxTSala.Items.Count == 0)
            {
                return;
            }
            String        turmaSelected = (String)comboBoxTSala.SelectedItem;
            SqlCommand    cmd           = new SqlCommand("select * from SAA.Alunos_Turmas_Do_TipoSala ('" + turmaSelected + "') ", BDconnection.getConnection());
            SqlDataReader reader        = cmd.ExecuteReader();

            listBox3.Items.Clear();
            while (reader.Read())
            {
                tipoSala B = new tipoSala();

                B.ID_Sala    = (int)reader["ID_Sala"];
                B.AnoLectivo = (int)reader["AnoLectivo"];
                B.ID_Turma   = (int)reader["ID_Turma"];
                B.TipoSala   = reader["tipoSala"].ToString();
                B.limiAlunos = (int)reader["Limite_Alunos"];
                B.ID_Dep     = (int)reader["ID_Dep"];

                listBox3.Items.Add(B);
            }
            BDconnection.getConnection().Close();
            curreteSala = 0;
            ShowTurma_Prof();
        }
Exemple #8
0
        //Load turmas para a list box2 das turmas dos professores
        private void FormProf_Turmas_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            String depSelected = (String)comboBox4.SelectedItem;
            //MessageBox.Show(depSelected);
            SqlCommand    cmd    = new SqlCommand("select * from SAA.Turmas_eachProf (" + Int32.Parse(depSelected) + ") ", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox2.Items.Clear();

            while (reader.Read())
            {
                Turma A = new Turma();

                A.ID_turma   = (int)reader["ID_turma"];
                A.AnoLectivo = (int)reader["AnoLectivo"];

                listBox2.Items.Add(A);
            }
            BDconnection.getConnection().Close();
            currentProfTurma = 0;
            ShowTurma_Prof();
        }
Exemple #9
0
        private void FormPerfilAluno_Load(object sender, EventArgs e)
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand    cmd    = new SqlCommand("SELECT * FROM SAA.Aluno", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBoxAluno.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();

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

            currentAluno = 0;
            ShowAluno();
        }
Exemple #10
0
        private void FormAlun_Turmas_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBoxT.Items.Count == 0)
            {
                return;
            }
            String turmaSelected = (String)comboBoxT.SelectedItem;
            //MessageBox.Show(depSelected);  //TROCAR AQU!!!
            SqlCommand    cmd    = new SqlCommand("select * from SAA.ALUNOS_TURMA_Y (" + Int32.Parse(turmaSelected) + ") ", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox2.Items.Clear();
            while (reader.Read())
            {
                relAlunosTurma B = new relAlunosTurma();

                B.ID_turma  = (int)reader["ID_turma"];
                B.TNMEC     = (int)reader["NMEC"];
                B.Idade     = (int)reader["Idade"];
                B.nome_Prof = reader["Nome"].ToString();
                B.Email     = reader["Email"].ToString();
                B.RegEstudo = reader["RegimeEstudo"].ToString();

                listBox2.Items.Add(B);
            }
            BDconnection.getConnection().Close();
            currentT = 0;
            ShowTurma_Prof();
        }
Exemple #11
0
        //Form LOAD dados TURMA
        private void FormTurmas_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }


            SqlCommand    cmd    = new SqlCommand("EXEC SAA.data_TURMA", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            listBox1.Items.Clear();

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



                listBox1.Items.Add(A);
            }
            BDconnection.getConnection().Close();
            currentTurma = 0;
            ShowTurma();
        }
Exemple #12
0
        private void listHorarios_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listHorarios.SelectedIndex >= 0)
            {
                currentHorario     = listHorarios.SelectedIndex;
                current_id_horario = listHorarios.Items[currentHorario].ToString();

                listaAlunos.Visible = true;
                labelnmec2.Visible  = true;
                labelnome2.Visible  = true;

                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }

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

                cmd.CommandText = "Select * from SAA.DADOS_HOR_X2 (@ID_Horario)";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@ID_Horario", current_id_horario);

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

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

                    aluProf.NomeProf    = reader["Nome_Prof"].ToString();
                    aluProf.EmailProf   = reader["Email_Prof"].ToString();
                    aluProf.TNMEC       = reader["TMEC"].ToString();
                    aluProf.numGabinete = (int)reader["Num_Gabinete"];
                    aluProf.ID_Dep      = (int)reader["ID_Dep"];

                    listaAlunos.Items.Add(aluProf);
                }

                BDconnection.getConnection().Close();

                currentAluno = 0;
                ShowDados();
            }
        }
Exemple #13
0
        //ADICIONAR TURMA
        private void adicionarTurma()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = BDconnection.getConnection();



            if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty((String)comboBoxHor.SelectedItem) || String.IsNullOrEmpty((String)comboBoxProf.SelectedItem) || String.IsNullOrEmpty(textBox4.Text))
            {
                MessageBox.Show("Todos os campos devem estar preenchidos!");
            }

            cmd.CommandText = "EXEC SAA.addTurma @id, @tnmec, @idHorario,@anoLect";
            cmd.Parameters.Clear();

            cmd.Parameters.AddWithValue("@id", Int32.Parse(textBox1.Text));
            cmd.Parameters.AddWithValue("@tnmec", Int32.Parse((String)comboBoxProf.SelectedItem));
            cmd.Parameters.AddWithValue("@idHorario", Int32.Parse((String)comboBoxHor.SelectedItem));
            cmd.Parameters.AddWithValue("@anoLect", Int32.Parse(textBox4.Text));

            try
            {
                cmd.ExecuteNonQuery();
                MessageBox.Show("Dados inseridos com sucesso!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Turma ID deve ser único!");
            }
            finally
            {
                BDconnection.getConnection().Close();
            }


            FormTurmas_Load();

            textBox2.Visible    = true;
            textBox3.Visible    = true;
            button1.Visible     = true;
            button3.Visible     = true;
            button2.Visible     = true;
            buttonOkUp.Visible  = false;
            buttonAddOK.Visible = false;

            comboBoxHor.Visible  = false;
            comboBoxProf.Visible = false;
        }
Exemple #14
0
        //LOAD_COMBOBOX com as turmas de cada professor
        //mete na combobox4 os ids dos stores
        private void TurmaProf_Load()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("select distinct TNEMC from SAA.TURMA order by TNEMC", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox4.Items.Add(reader["TNEMC"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #15
0
        //COMBOBOX
        //carregar departamentos
        private void loadSelectDepartamentos()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("select Nome_Dep from SAA.DEPARTAMENTO group by Nome_Dep", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["Nome_Dep"].ToString());
            }
            BDconnection.getConnection().Close();
        }
        private void showProfs()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.NomeProf", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["Nome_Prof"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #17
0
        //COMBOBOX
        private void loadHorario()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("select ID_Horario from SAA.PROFESSOR order by ID_Horario", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox3.Items.Add(reader["ID_Horario"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #18
0
        private void loadTnmec()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.Tnmecs", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBoxProf.Items.Add(reader["TMEC"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #19
0
        //add nome dos departamentos à combo box
        private void Nome_Dep()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.NOME_DEPARTAMENTOS", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBoxDep.Items.Add(reader["Nome_Dep"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #20
0
        //add n_biblios à combobox
        private void N_BIBLIOS()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.N_BIBLIOS", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBoxBiblio.Items.Add(reader["ID_Biblioteca"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #21
0
        private void loadHoraios()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.IDsHoraios", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBoxHor.Items.Add(reader["ID_Horario"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #22
0
        // COMBOBOX
        //carregar departamentos
        private void loadDepID()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("select ID_DEP from SAA.DEPARTAMENTO order by ID_DEP", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBox2.Items.Add(reader["ID_DEP"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #23
0
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////////////
        /// </summary>


        private void tipoSala()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            SqlCommand    cmd    = new SqlCommand("EXEC SAA.tipoSala1", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                comboBoxTSala.Items.Add(reader["tipoSala"].ToString());
            }
            BDconnection.getConnection().Close();
        }
Exemple #24
0
        private void eliminarBtn_Click(object sender, EventArgs e)
        {
            if (!BDconnection.verifySGBDConnection())
            {
                if (!BDconnection.verifySGBDConnection())
                {
                    return;
                }
            }

            Object obj = MessageBox.Show("Tem a certeza que pretende eliminar?", "", MessageBoxButtons.YesNo);

            if (obj.ToString().Equals("Yes"))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = BDconnection.getConnection();

                cmd.CommandText = "EXEC SAA.del_Aluno @NMEC";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@NMEC", nmecAluno.Text);

                cmd.ExecuteNonQuery();
                BDconnection.getConnection().Close();

                FormPerfilAluno_Load(sender, e);
                ShowAluno();

                confirmBtn.Visible   = false;
                confirmBtn2.Visible  = false;
                cancelarBtn.Visible  = false;
                adicionarBtn.Visible = true;
                updateBtn.Visible    = true;
                limparBtn.Visible    = false;
                eliminarBtn.Visible  = true;

                nomeAluno.ReadOnly         = true;
                emailAluno.ReadOnly        = true;
                nmecAluno.ReadOnly         = true;
                nmecTutorAluno.ReadOnly    = true;
                idadeAluno.ReadOnly        = true;
                idCursoAluno.ReadOnly      = true;
                idBibliotecaAluno.ReadOnly = true;
                idHorarioAluno.ReadOnly    = true;
                passAluno.ReadOnly         = true;

                regimeEstudoAluno.Enabled = false;
            }
        }
Exemple #25
0
        private void Login_Click(object sender, EventArgs e)
        {
            bool w = false;

            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = BDconnection.getConnection();
            cmd.CommandText = "select Email, PasswordAccount from SAA.ALUNO";
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                //ja lê da BD
                //reader["Email"].ToString()
                //reader["PasswordAccount"].ToString()
                if (mailBox.Text.Equals("1") & passBox.Text.Equals("1"))
                {
                    w = true;


                    break;

                    // FormMenu fMenu = new FormMenu();
                    //home_Page.ShowDialog();
                    //.Close();
                    //fMenu.ShowDialog();
                    //  MessageBox.Show("Sim");
                }
                else
                {
                    MessageBox.Show("Email ou password estão incorretas");
                }
            }
            BDconnection.getConnection().Close();

            if (w == true)
            {
                this.Hide();
                FormHomePage home_Page = new FormHomePage();
                home_Page.ShowDialog();
            }
        }
Exemple #26
0
        private void adicionarHorarioBtn_Click(object sender, EventArgs e)
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

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

                cmd.CommandText = "EXEC SAA.addHorario";
                cmd.Parameters.Clear();

                cmd.ExecuteNonQuery();
                BDconnection.getConnection().Close();
            }
            catch (SqlException ex)
            {
                DisplaySqlErrors(ex);
            }

            FormHorario_Load(sender, e);
            ShowAluno();

            confirmBtn.Visible   = false;
            confirmBtn2.Visible  = false;
            cancelarBtn.Visible  = false;
            adicionarBtn.Visible = true;
            updateBtn.Visible    = true;
            limparBtn.Visible    = false;
            eliminarBtn.Visible  = true;

            nomeAluno.ReadOnly         = true;
            emailAluno.ReadOnly        = true;
            nmecAluno.ReadOnly         = true;
            nmecTutorAluno.ReadOnly    = true;
            idadeAluno.ReadOnly        = true;
            idCursoAluno.ReadOnly      = true;
            idBibliotecaAluno.ReadOnly = true;
            idHorarioAluno.ReadOnly    = true;
            passAluno.ReadOnly         = true;

            regimeEstudoAluno.Enabled = false;
        }
Exemple #27
0
        //mostrar alunos de um departamento
        private void comboBoxDep_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = BDconnection.getConnection();

            cmd.CommandText = "EXEC SAA.ALUNO_DE_DEPARTAMENTO @Nome_Dep";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Nome_Dep", (String)comboBoxDep.SelectedItem);


            SqlDataReader reader = cmd.ExecuteReader();

            listBoxAluno.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();

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

            currentAluno = 0;
            ShowAluno();

            comboBoxCurso.Text  = "";
            comboBoxTurma.Text  = "";
            comboBoxBiblio.Text = "";
        }
Exemple #28
0
        //Mete na textBox o numero total de turmas
        private void loadTotalTurmas_Prof()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBox4.Items.Count == 0)
            {
                return;
            }

            String        depSelected = (String)comboBox4.SelectedItem;
            SqlCommand    cmd         = new SqlCommand("SAA.totalTurmas_CadaProf " + Int32.Parse(depSelected) + " ", BDconnection.getConnection());
            SqlDataReader reader      = cmd.ExecuteReader();

            while (reader.Read())
            {
                textBox5.Text = reader["totalTurmas_Prof"].ToString();
            }
            BDconnection.getConnection().Close();
        }
Exemple #29
0
        private void loadTurma()
        {
            if (!BDconnection.verifySGBDConnection())
            {
                return;
            }
            if (comboBox1.Items.Count == 0)
            {
                return;
            }
            String depSelected = (String)comboBox1.SelectedItem;

            SqlCommand    cmd    = new SqlCommand("select * from SAA.TOTAL_PROFESSORES_DEP_Y ('" + depSelected + "') ", BDconnection.getConnection());
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                textBoxTotalprofs.Text = reader["TOTAL_PROF_DEP"].ToString();
            }
            BDconnection.getConnection().Close();
        }
Exemple #30
0
        private void listaAlunos()
        {
            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 = currentAluno2;

            ShowAluno();
        }