Example #1
0
        public List <Answer_Components_Exploded_ForJSON> GetOverrideQuestions(int assessmentId, int question_id, int Component_Symbol_Id)
        {
            List <Answer_Components_Exploded_ForJSON> rlist = new List <Answer_Components_Exploded_ForJSON>();

            using (CSET_Context context = new CSET_Context())
            {
                List <usp_getExplodedComponent> questionlist = null;

                context.LoadStoredProc("[dbo].[usp_getExplodedComponent]")
                .WithSqlParam("assessment_id", _assessmentId)
                .ExecuteStoredProc((handler) =>
                {
                    questionlist = handler.ReadToList <usp_getExplodedComponent>().Where(c => c.Question_Id == question_id &&
                                                                                         c.Component_Symbol_Id == Component_Symbol_Id).ToList();
                });

                IQueryable <Answer_Components> answeredQuestionList = context.Answer_Components.Where(a =>
                                                                                                      a.Assessment_Id == assessmentId && a.Question_Or_Requirement_Id == question_id);


                foreach (var question in questionlist.ToList())
                {
                    Answer_Components_Exploded_ForJSON tmp = null;
                    tmp = TinyMapper.Map <Answer_Components_Exploded_ForJSON>(question);
                    tmp.Component_GUID = question.Component_GUID.ToString();
                    rlist.Add(tmp);
                }
                return(rlist);
            }
        }
Example #2
0
        public List <Answer_Components_Exploded_ForJSON> GetOverrideQuestions(int assessmentId, int question_id, int Component_Symbol_Id)
        {
            List <Answer_Components_Exploded_ForJSON> rlist = new List <Answer_Components_Exploded_ForJSON>();

            using (CSET_Context context = new CSET_Context())
            {
                IQueryable <Answer_Components_Exploded> questionlist = from a in context.Answer_Components_Exploded
                                                                       where a.Assessment_Id == assessmentId &&
                                                                       a.Question_Id == question_id &&
                                                                       a.Component_Symbol_Id == Component_Symbol_Id
                                                                       select a;
                IQueryable <Answer_Components> answeredQuestionList = context.Answer_Components.Where(a =>
                                                                                                      a.Assessment_Id == assessmentId && a.Question_Or_Requirement_Id == question_id);


                foreach (var question in questionlist.ToList())
                {
                    Answer_Components_Exploded_ForJSON tmp = null;
                    tmp = TinyMapper.Map <Answer_Components_Exploded_ForJSON>(question);
                    tmp.Component_GUID = question.Component_GUID.ToString();
                    rlist.Add(tmp);
                }
                return(rlist);
            }
        }