Exemplo n.º 1
0
        public ExamEntity getExambyname(string nombreexamen, int numPreguntas)
        {
            ExamBL exambl = new ExamBL();
            List <ResponseEntity> correctas   = new List <ResponseEntity>();
            List <ResponseEntity> incorrectas = new List <ResponseEntity>();

            QuestionBL            questionbl = new QuestionBL();
            ResponseBL            responsebl = new ResponseBL();
            ExamEntity            exam       = exambl.getexambyname(nombreexamen, numPreguntas);
            List <QuestionEntity> questions  = questionbl.GetQuestionsByExamID(exam.idexamen, numPreguntas);

            foreach (QuestionEntity question in questions)
            {
                List <ResponseEntity> responses = responsebl.GetResponseFromQuestionID(question.idPregunta);
                foreach (ResponseEntity res in responses)
                {
                    if (res.RespuestaCorrecta > 0)
                    {
                        correctas.Add(res);
                    }
                    else if (res.RespuestaCorrecta < 1)
                    {
                        incorrectas.Add(res);
                    }
                }
                exam.correctas   = correctas;
                exam.incorrectas = incorrectas;
            }

            return(exam);
        }
Exemplo n.º 2
0
        public List <QuestionEntity> GetquestionWithResponses(string course, string area, int questionnumber)
        {
            QuestionBL            questionBL = new QuestionBL();
            ResponseBL            responseBL = new ResponseBL();
            List <QuestionEntity> questions  = questionBL.GetquestionWithResponses(course, area, questionnumber);

            foreach (QuestionEntity que in questions)
            {
                que.responses = responseBL.GetResponsesFromQuestion(que);
            }
            return(questions);
        }
Exemplo n.º 3
0
        public ResultExamStudentEntity CalificateQuestions(List <QuestionEntity> questions, string curso, string area, string nombreusuario, string documento)
        {
            List <QuestionEntity> questionsInDB = new List <QuestionEntity>();
            QuestionBL            questionBL    = new QuestionBL();
            int    totalPregunta           = questions.Count;
            int    totalcorrecto           = 0;
            double totalcorrectasporexamen = 0;

            ResultExamStudentEntity resultExam = new ResultExamStudentEntity();

            resultExam.questionsStudent = questions;
            ResponseBL responseBL = new ResponseBL();

            foreach (QuestionEntity que in questions)
            {
                ResponseEntity response = new ResponseEntity();
                QuestionEntity question = new QuestionEntity();
                question = questionBL.Getstudentquestions(curso, area, que.descripcionPregunta);
                response = responseBL.GetCorrectResponseFromQuestion(question);
                question.respuestaDBCorrecta = response;
                if (question.respuestaDBCorrecta.DescripcionRespuesta == que.RespuestaUsuario.DescripcionRespuesta)
                {
                    totalcorrecto++;
                }
                questionsInDB.Add(question);
            }
            resultExam.QuestionDB   = questionsInDB;
            totalcorrectasporexamen = (totalcorrecto * 5) / totalPregunta;
            resultExam.puntaje      = totalcorrectasporexamen;
            UserBL       userbl   = new UserBL();
            CourseBL     courseBL = new CourseBL();
            UserEntity   user     = userbl.GetUser(nombreusuario, documento);
            CourseEntity course   = courseBL.GetCourse(curso, area);

            EstudianteCursoBL estudianteCursoBL = new EstudianteCursoBL();

            estudianteCursoBL.GuardarCalificacion(user, course, totalcorrectasporexamen);

            return(resultExam);
        }
Exemplo n.º 4
0
        public bool insertQuestionResponses(QuestionListResponsesEntity questionResponses)
        {
            bool       inserto            = false;
            int        counttrue          = 0;
            ResponseBL questionResponseBL = new ResponseBL();

            foreach (ResponseEntity questionResponse in questionResponses.questionresponses)
            {
                inserto = false;
                inserto = questionResponseBL.insertQuestionResponses(questionResponse);
                if (inserto == true)
                {
                    counttrue++;
                }
            }
            if (counttrue > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }