Ejemplo n.º 1
0
        public IEnumerable<AssessmentResponse> GetResponseWithDeficiencies(Guid userId, int moduleId)
        {
            QuestionBus questionBus;
            ResponseBus responseBus;
            IEnumerable<AssessmentResponse> assessmentResponses = null;
            IEnumerable<Tbl_QuestionBank> questions = null;
            IEnumerable<Tbl_QuestionResponse> responses = null;
            IEnumerable<Tbl_QuestionDeficient> deficiences = null;
            try
            {
                questionBus = new QuestionBus();
                responseBus = new ResponseBus();

                questions = questionBus.GetQuestions(moduleId);
                responses = responseBus.GetResponses(userId, moduleId);
                deficiences = responseBus.GetDeficiences();

                if (responses.Count() == 0)
                    responses = CreateDefaultResponses(userId, questions);

                assessmentResponses = from questionBank in questions.Where(r => r.Recommendation!= null).GroupBy(r => r.Recommendation).Select(x=>x.First())
                                      join questionResponse in responses on questionBank.Id equals questionResponse.QuestionId
                                      join questionDeficient in deficiences on questionResponse.Value equals questionDeficient.UserResponseValue
                                      where questionResponse.CreatedBy == userId  && questionDeficient.IsDeficient == true
                                      select new AssessmentResponse() { QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId, IsDeficient = questionDeficient .IsDeficient.Value, Recommendation= questionBank.Recommendation};

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return assessmentResponses;
        }
Ejemplo n.º 2
0
        public IEnumerable<AssessmentResponse> GetResponse(Guid userId, int moduleId)
        {
            QuestionBus questionBus;
            ResponseBus responseBus;
            IEnumerable<AssessmentResponse> assessmentResponses = null;
            IEnumerable<Tbl_QuestionBank> questions = null;
            IEnumerable<Tbl_QuestionResponse> responses = null;
            try
            {
                questionBus = new QuestionBus();
                responseBus = new ResponseBus();

                questions = questionBus.GetQuestions(moduleId);
                responses= responseBus.GetResponses(userId,moduleId);

                if (responses.Count() == 0)
                    responses = CreateDefaultResponses(userId, questions);

                //assessmentResponses = from questionBank in questions
                //                      from questionResponse in responses.Where(r => r.QuestionId == questionBank.Id && r.CreatedBy == userId)
                //                      select new AssessmentResponse() { QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId }; 
                assessmentResponses = from questionBank in questions join 
                                      questionResponse in responses on questionBank.Id equals questionResponse.QuestionId
                                      where questionResponse.CreatedBy == userId
                                      select new AssessmentResponse() { QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId };                
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return assessmentResponses;
        }
Ejemplo n.º 3
0
        public IEnumerable <AssessmentResponse> GetResponseWithDeficiencies(Guid userId, int moduleId)
        {
            QuestionBus questionBus;
            ResponseBus responseBus;
            IEnumerable <AssessmentResponse>    assessmentResponses = null;
            IEnumerable <Tbl_QuestionBank>      questions           = null;
            IEnumerable <Tbl_QuestionResponse>  responses           = null;
            IEnumerable <Tbl_QuestionDeficient> deficiences         = null;

            try
            {
                questionBus = new QuestionBus();
                responseBus = new ResponseBus();

                questions   = questionBus.GetQuestions(moduleId);
                responses   = responseBus.GetResponses(userId, moduleId);
                deficiences = responseBus.GetDeficiences();

                if (responses.Count() == 0)
                {
                    responses = CreateDefaultResponses(userId, questions);
                }

                assessmentResponses = from questionBank in questions.Where(r => r.Recommendation != null).GroupBy(r => r.Recommendation).Select(x => x.First())
                                      join questionResponse in responses on questionBank.Id equals questionResponse.QuestionId
                                      join questionDeficient in deficiences on questionResponse.Value equals questionDeficient.UserResponseValue
                                      where questionResponse.CreatedBy == userId && questionDeficient.IsDeficient == true
                                      select new AssessmentResponse()
                {
                    QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId, IsDeficient = questionDeficient.IsDeficient.Value, Recommendation = questionBank.Recommendation
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(assessmentResponses);
        }
Ejemplo n.º 4
0
        public IEnumerable <AssessmentResponse> GetResponse(Guid userId, int moduleId)
        {
            QuestionBus questionBus;
            ResponseBus responseBus;
            IEnumerable <AssessmentResponse>   assessmentResponses = null;
            IEnumerable <Tbl_QuestionBank>     questions           = null;
            IEnumerable <Tbl_QuestionResponse> responses           = null;

            try
            {
                questionBus = new QuestionBus();
                responseBus = new ResponseBus();

                questions = questionBus.GetQuestions(moduleId);
                responses = responseBus.GetResponses(userId, moduleId);

                if (responses.Count() == 0)
                {
                    responses = CreateDefaultResponses(userId, questions);
                }

                //assessmentResponses = from questionBank in questions
                //                      from questionResponse in responses.Where(r => r.QuestionId == questionBank.Id && r.CreatedBy == userId)
                //                      select new AssessmentResponse() { QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId };
                assessmentResponses = from questionBank in questions join
                                      questionResponse in responses on questionBank.Id equals questionResponse.QuestionId
                                      where questionResponse.CreatedBy == userId
                                      select new AssessmentResponse()
                {
                    QuestionId = questionBank.Id, ModuleId = moduleId, Question = questionBank.Text, QuestionTooltip = questionBank.ToolTipText, Response = questionResponse.Value, ResponseId = questionResponse.Id, SerialNumber = questionBank.SrNo, UserId = userId
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(assessmentResponses);
        }