private void LoadData(QuestionPoco question, int assessment_id) { List <QuestionInformationTabData> list = new List <QuestionInformationTabData>(); bool isRequirement = question.IsRequirement; if (question.IsFramework) { FrameworkInfoData frameworkData = new FrameworkInfoData() { SupplementalInfo = question.ProfileQuestionData.SupplementalInfo, SetName = question.GetRequirementSet().Set_Name, IsCustomQuestion = question.ProfileQuestionData.IsCustomQuestion, References = question.ProfileQuestionData.References, Title = question.ProfileQuestionData.Category.ProfileFunction.Function_ID + "." + question.ProfileQuestionData.Category.SubLabel + "-" + question.QuestionNumber, Category = question.ProfileQuestionData.CategoryHeading, RequirementID = question.Question_or_Requirement_ID }; list = informationTabBuilder.CreateFrameworkInformationTab(frameworkData); } else if (question.IsQuestion && !question.IsComponent) { QuestionInfoData questionInfoData = new QuestionInfoData() { QuestionID = question.Question_or_Requirement_ID, Set = question.SetName == null?null:question.DictionaryStandards[question.SetName], Sets = question.DictionaryStandards, Question = question.Question, Requirement = question.NEW_REQUIREMENT ?? question.Question.NEW_REQUIREMENTs().FirstOrDefault(t => t.REQUIREMENT_SETS.Select(s => s.Set_Name).Contains(question.SetName ?? question.DictionaryStandards.Keys.FirstOrDefault())) }; list = informationTabBuilder.CreateQuestionInformationTab(questionInfoData); } else if (question.IsComponent) { var stuff = from a in this.DataContext.Answer_Components_Exploded join l in this.DataContext.UNIVERSAL_SAL_LEVEL on a.SAL equals l.Full_Name_Sal where a.Assessment_Id == assessment_id && a.Question_Id == question.Question_or_Requirement_ID select new { a.Component_Symbol_Id, a.SAL, l.Sal_Level_Order }; Dictionary <int, ComponentTypeSalData> dictionaryComponentTypes = new Dictionary <int, ComponentTypeSalData>(); foreach (var item in stuff.ToList()) { ComponentTypeSalData salData; if (dictionaryComponentTypes.TryGetValue(item.Component_Symbol_Id, out salData)) { salData.SALLevels.Add(item.Sal_Level_Order); } else { HashSet <int> SALLevels = new HashSet <int>(); SALLevels.Add(item.Sal_Level_Order); salData = new ComponentTypeSalData() { Component_Symbol_Id = item.Component_Symbol_Id, SALLevels = SALLevels }; dictionaryComponentTypes.Add(item.Component_Symbol_Id, salData); } } if (symbolInfo == null) { symbolInfo = this.DataContext.COMPONENT_SYMBOLS .ToDictionary(x => x.Component_Symbol_Id, data => data); } //select component_type, ComponentName, SAL from Answer_Components_Exploded //where Assessment_Id = 6 and question_id = 1586 ; ComponentQuestionInfoData componentQuestionInfoData = new ComponentQuestionInfoData() { QuestionID = question.Question_or_Requirement_ID, Question = question.Question, Set = this.DataContext.SETS.Where(x => x.Set_Name == "Components").First(), DictionaryComponentTypes = dictionaryComponentTypes, DictionaryComponentInfo = symbolInfo }; list = informationTabBuilder.CreateComponentInformationTab(componentQuestionInfoData); } else if (question.IsRequirement) { var sets = question.GetRequirementSets().Distinct().ToDictionary(s => s.Set_Name); var set = question.GetRequirementSet().Set_Name; if (question.NEW_REQUIREMENT == null) { //var rs = this.DataContext.REQUIREMENT_QUESTIONS_SETS.Where(x => x.Question_Id == question.Question_or_Requirement_ID && x.Set_Name == set).First(); question.NEW_REQUIREMENT = this.DataContext.NEW_REQUIREMENT.Where(x => x.Requirement_Id == question.Question_or_Requirement_ID).FirstOrDefault(); } RequirementInfoData reqInfoData = new RequirementInfoData() { RequirementID = question.Question_or_Requirement_ID, SetName = set, Category = question.Category, Sets = sets, Requirement = question.NEW_REQUIREMENT }; reqInfoData.Requirement.REQUIREMENT_LEVELS = this.DataContext.REQUIREMENT_LEVELS.Where(x => x.Requirement_Id == question.Question_or_Requirement_ID).ToList(); list = informationTabBuilder.CreateRequirementInformationTab(reqInfoData, levelManager); } SetTabDataList(list); this.Is_Component = question.IsComponent; }
private void LoadData(QuestionPoco question) { List <QuestionInformationTabData> list = new List <QuestionInformationTabData>(); bool isRequirement = question.IsRequirement; if (question.IsFramework) { FrameworkInfoData frameworkData = new FrameworkInfoData() { SupplementalInfo = question.ProfileQuestionData.SupplementalInfo, SetName = question.GetRequirementSet().Set_Name, IsCustomQuestion = question.ProfileQuestionData.IsCustomQuestion, References = question.ProfileQuestionData.References, Title = question.ProfileQuestionData.Category.ProfileFunction.Function_ID + "." + question.ProfileQuestionData.Category.SubLabel + "-" + question.QuestionNumber, Category = question.ProfileQuestionData.CategoryHeading, RequirementID = question.Question_or_Requirement_ID }; list = informationTabBuilder.CreateFrameworkInformationTab(frameworkData); } else if (question.IsQuestion && !question.IsComponent) { QuestionInfoData questionInfoData = new QuestionInfoData() { QuestionID = question.Question_or_Requirement_ID, Set = question.SetName == null?null:question.DictionaryStandards[question.SetName], Sets = question.DictionaryStandards, Question = question.Question, Requirement = question.NEW_REQUIREMENT ?? question.Question.NEW_REQUIREMENTs().FirstOrDefault(t => t.REQUIREMENT_SETS.Select(s => s.Set_Name).Contains(question.SetName ?? question.DictionaryStandards.Keys.FirstOrDefault())) }; list = informationTabBuilder.CreateQuestionInformationTab(questionInfoData); } else if (question.IsComponent) { ComponentQuestionInfoData componentQuestionInfoData = new ComponentQuestionInfoData() { QuestionID = question.Question_or_Requirement_ID, Question = question.Question, Set = question.DictionaryStandards.Values.FirstOrDefault(), //TODO !!!NEED to get the list of component types at sal levels here //DictionaryComponentTypes = assessmentModel.NetworkModel.NetworkData.DictionaryComponentTypes, //I can't do this until I actually have a diagram to pull the information from. DictionaryComponentTypes = new Dictionary <string, ComponentTypeSalData>(), DictionaryComponentInfo = symbolRepository.GetComponentInfoTabData() }; list = informationTabBuilder.CreateComponentInformationTab(componentQuestionInfoData); } else if (question.IsRequirement) { var sets = question.GetRequirementSets().Distinct().ToDictionary(s => s.Set_Name); var set = question.GetRequirementSet().Set_Name; if (question.NEW_REQUIREMENT == null) { question.NEW_REQUIREMENT = this.DataContext.NEW_REQUIREMENT.Where(x => x.Requirement_Id == question.Question_or_Requirement_ID).FirstOrDefault(); } RequirementInfoData reqInfoData = new RequirementInfoData() { RequirementID = question.Question_or_Requirement_ID, SetName = set, Category = question.Category, Sets = sets, Requirement = question.NEW_REQUIREMENT }; list = informationTabBuilder.CreateRequirementInformationTab(reqInfoData, levelManager); } SetTabDataList(list); }