Esempio n. 1
0
        public bool Login()
        {
            ClsConexao conexao = new ClsConexao();

            try
            {
                conexao.conectar();
                SqlCommand cmd = new SqlCommand("sp_Vizualizar_Usuario", conexao.conexao);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@pDs_Usuario", mDs_Usuario);
                cmd.Parameters.AddWithValue("@pDs_Senha", mDs_Senha);
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);
                if (dr.Read())
                {
                    Ds_Usuario = dr["Ds_Usuario"].ToString();
                    Ds_Senha   = dr["Ds_Senha"].ToString();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
            finally
            {
                conexao.desconectar();
            }
        }
Esempio n. 2
0
        public int maxID()
        {
            int        codigo;
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();

            SqlCommand cmd = new SqlCommand("sp_MAX_Questao", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            try
            {
                if (dr.HasRows)
                {
                    dr.Read();
                    codigo = Convert.ToInt32(dr["IDNOVO"].ToString());
                    return(codigo);
                }
                else
                {
                    return(codigo = 1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocorreu o seguinte erro: " + ex.Message);
                return(0);
            }
            finally
            {
                conexao.desconectar();
            }
        }
Esempio n. 3
0
        public override void Desativa()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Inativo_Prova", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId", mId_Prova);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            mObjconexao.desconectar();
        }
Esempio n. 4
0
        public void InserirQuestaoProva()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Ins_Questao_Prova", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Prova", mId_Prova);
            cmd.Parameters.AddWithValue("@pId_Questao", mId_Questao);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            mObjconexao.desconectar();
        }
Esempio n. 5
0
        public override void Inserir()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Ins_Curso", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pNm_Curso", mNm_Curso);
            cmd.Parameters.AddWithValue("@pAbrev_Nm_Curso", mAbrev_Nm_Curso);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            conexao.desconectar();
        }
Esempio n. 6
0
        public override void Atualizar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Upd_Alternativas", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Alternativas", mId_Alternativas);
            cmd.Parameters.AddWithValue("@pDs_Alternativa", mDs_Alternativa);
            cmd.Parameters.AddWithValue("@pSt_Verificacao", mSt_Verificacao);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            conexao.desconectar();
        }
Esempio n. 7
0
        public override void Inserir()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Ins_Prova", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pNm_Prova", mNm_Prova);
            cmd.Parameters.AddWithValue("@pSt_Prova", 1);
            cmd.Parameters.AddWithValue("@pId_Prontuario", 1);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            mObjconexao.desconectar();
        }
Esempio n. 8
0
        public override void Atualizar()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Upd_Materia", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Curso", mId_Curso);
            cmd.Parameters.AddWithValue("@pId_Materia", mId_Materia);
            cmd.Parameters.AddWithValue("@pNm_Materia", mNm_Materia);
            cmd.Parameters.AddWithValue("@pAbrev_Nm_Materia", mSg_Materia);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            mObjconexao.desconectar();
        }
Esempio n. 9
0
        public override void PreencheGrid()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Select_Prova", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        DSU = new DataSet();

            da.Fill(DSU);
            DSProva = DSU;
            conexao.desconectar();
        }
Esempio n. 10
0
        public override void Inserir()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Ins_Questao", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pDs_Pergunta     ", mDs_Pergunta);
            cmd.Parameters.AddWithValue("@pDs_Justificativa", mDs_Justificativa);
            cmd.Parameters.AddWithValue("@pId_Materia      ", mId_Materia);
            cmd.Parameters.AddWithValue("@pId_Prontuario   ", mId_Prontuario);
            cmd.Parameters.AddWithValue("@pSt_Pergunta     ", 1);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            conexao.desconectar();
        }
Esempio n. 11
0
        public void ImprimiGabarito()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("Sp_Gabarito", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pIdProva", mId_Prova);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        DSU = new DataSet();

            da.Fill(DSU);
            DSProva = DSU;
            mObjconexao.desconectar();
        }
Esempio n. 12
0
        public void SelecionaCursoMateria()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("Sp_Selecionar_Curso_Materia", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pIdCurso", mId_Curso);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        DSU = new DataSet();

            da.Fill(DSU);
            DSProva = DSU;
            conexao.desconectar();
        }
Esempio n. 13
0
        public override void Selecionar()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_SelectWr_Prova", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId", mId_Prova);
            SqlDataReader DR = cmd.ExecuteReader(CommandBehavior.SingleRow);

            DR.Read();
            Nm_Prova      = DR[1].ToString();
            Id_Prontuario = Convert.ToInt32(DR[3]);
            mObjconexao.desconectar();
        }
Esempio n. 14
0
        public override void Selecionar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_SelectWr_Alternativa", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId", mId_Questao);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        DSU = new DataSet();

            da.Fill(DSU);
            DSAlternariva = DSU;
            conexao.desconectar();
        }
Esempio n. 15
0
        public override void Selecionar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_SelectWr_Curso", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Curso", mId_Curso);
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            Id_Curso = Convert.ToInt32(dr["id_curso"]);
            Nm_Curso = dr["nm_curso"].ToString();
            Nm_Curso = dr["abrev_nm_curso"].ToString();
            conexao.desconectar();
        }
Esempio n. 16
0
        public override void Atualizar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Upd_Usuario", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pNm_Usuario", mNm_Usuario);
            cmd.Parameters.AddWithValue("@pDs_Usuario", mDs_Usuario);
            cmd.Parameters.AddWithValue("@pDs_Senha", mDs_Senha);
            cmd.Parameters.AddWithValue("@pSt_Usuario", mSt_Usuario);
            cmd.Parameters.AddWithValue("@pId_Prontuario", mId_Prontuario);
            cmd.ExecuteReader(CommandBehavior.SingleRow);
            conexao.desconectar();
        }
Esempio n. 17
0
        public void SelecionaQuestaoProva()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Select_Gprova", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Materia", mId_Materia);
            cmd.Parameters.AddWithValue("@pQnt", mQtd);
            SqlDataAdapter da  = new SqlDataAdapter(cmd);
            DataSet        DSU = new DataSet();

            da.Fill(DSU);
            DSProva = DSU;
            mObjconexao.desconectar();
        }
Esempio n. 18
0
        public override void Selecionar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Vizualizar_Usuario", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Prontuario", mId_Prontuario);
            SqlDataReader dr        = cmd.ExecuteReader(CommandBehavior.SingleRow);
            ClsProfessor  professor = new ClsProfessor();

            professor.Id_Prontuario = mId_Prontuario;
            professor.Nm_Usuario    = dr["nm_usuario"].ToString();
            professor.St_Usuario    = Convert.ToInt32(dr["St_Usuario"].ToString());
            conexao.desconectar();
        }
Esempio n. 19
0
        public override void Selecionar()
        {
            ClsConexao mObjconexao = new ClsConexao();

            mObjconexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Upd_Materia", mObjconexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId_Materia", mId_Materia);
            SqlDataReader DR = cmd.ExecuteReader(CommandBehavior.SingleRow);

            DR.Read();
            Id_Materia = Convert.ToInt32(DR["Id_Materia"]);
            Nm_Materia = DR["Nm_Materia"].ToString();
            Sg_Materia = DR["Abrev_Nm_Materia"].ToString();
            Id_Curso   = Convert.ToInt32(DR["Id_Curso"]);
            mObjconexao.desconectar();
        }
Esempio n. 20
0
        public override void Selecionar()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_SelectWr_Questao", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@pId", mId_Questao);
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            dr.Read();
            Id_Questao       = Convert.ToInt32(dr[0]);
            Ds_Pergunta      = dr[1].ToString();
            Ds_Justificativa = dr[2].ToString();
            Id_Prontuario    = Convert.ToInt32(dr[3]);
            conexao.desconectar();
        }
Esempio n. 21
0
        public void maxId()
        {
            ClsConexao conexao = new ClsConexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_MAX_Prova", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            if (dr.HasRows)
            {
                dr.Read();
                Id_Prova = Convert.ToInt32(dr["ID"].ToString());
            }
            else
            {
                Id_Prova = 1;
            }
            conexao.desconectar();
        }