コード例 #1
0
ファイル: SkillSetService.cs プロジェクト: ELS-STLCM/test
        /// <summary>
        /// To get the proxy object for step 4 of Skill set builder.
        /// </summary>
        /// <param name="skillSeTUrl"></param>
        /// <returns></returns>
        public IList<DocumentProxy> GetQuestionsForPreview(string skillSeTUrl)
        {
            List<DocumentProxy> questionsForSkillSetProxy = new List<DocumentProxy>();
            List<DocumentProxy> questionsForSkillSetProxyTemp = new List<DocumentProxy>();
            IList<Question> questionsForSkillSet = GetQuestionsForSkillSet(skillSeTUrl);
            SkillSet skillSetTemp = GetSkillSet(skillSeTUrl);

            //To get all the questions to a proxy from a skill set.
            foreach (Question questionItem in questionsForSkillSet)
            {
                DocumentProxy documentProxyItem = new DocumentProxy
                                                      {
                                                          LinkedItemReference = questionItem.CompetencyReferenceGuid,
                                                          Text = questionItem.QuestionText
                                                      };
                questionsForSkillSetProxy.Add(documentProxyItem);
            }

            //Grouping the Questions based on Competencies.
            //1) List of competencies not having questions
            List<string> competenciesWithoutQuestions = (from lstCom in skillSetTemp.Competencies where !((from item in questionsForSkillSetProxy select item.LinkedItemReference).Contains(lstCom)) select lstCom).ToList();
            //2) Set competency string for guids
            questionsForSkillSetProxy.ToList().ForEach(question => _competencyService.SetLinkedCompetencyTextForAQuestions(question.LinkedItemReference, question));
            var questions = questionsForSkillSetProxy.GroupBy(question => question.LinkedItemReference);

            //Forming the document proxy with list of questions for each Competency
            foreach (var group in questions)
            {
                List<string> qnTextList = new List<string>();
                string competencyVal = String.Empty;
                DocumentProxy documentProxyItem = new DocumentProxy();
                foreach (var groupItem in group)
                {
                    qnTextList.Add(groupItem.Text);
                    competencyVal = groupItem.LinkedItemReference;
                }
                documentProxyItem.AnswerTexts = qnTextList;
                documentProxyItem.Text = competencyVal;
                questionsForSkillSetProxyTemp.Add(documentProxyItem);
            }

            //Add competencies that do not have any questions.
            foreach (var item in competenciesWithoutQuestions)
            {
                DocumentProxy docProxy = new DocumentProxy
                                             {
                                                 AnswerTexts = new List<string>(),
                                                 Text = _competencyService.GetLinkedCompetencyNameForAGuid(item)
                                             };
                questionsForSkillSetProxyTemp.Add(docProxy);
            }
            questionsForSkillSetProxyTemp = questionsForSkillSetProxyTemp.OrderBy(competencies => competencies.Text).ToList();

            return questionsForSkillSetProxyTemp;
        }
コード例 #2
0
ファイル: CompetencyService.cs プロジェクト: ELS-STLCM/test
 /// <summary>
 /// Get LinkedCompetency Text for a competency guid
 /// </summary>
 /// <param name="guidOfLinkedCompetency"></param>
 /// <param name="documentProxy"> </param>
 /// <returns></returns>
 public void SetLinkedCompetencyTextForAQuestions(string guidOfLinkedCompetency,DocumentProxy documentProxy)
 {
     List<AutoCompleteProxy> lstOfAutoComplete = GetAllCompetencyListForDropDown();
     documentProxy.LinkedItemReference=(from lstCompetency in lstOfAutoComplete where lstCompetency.id == guidOfLinkedCompetency select lstCompetency.name).SingleOrDefault();
 }