protected internal StandardSetWebCMS ReturnWebCMSData(List <Datum> result, string guidString)
        {
            StandardSetWebCMS standardSetWebCMS = new StandardSetWebCMS();
            string            standardSetName = string.Empty, content = string.Empty;
            List <LevelDict>  levelList = new List <LevelDict>();
            LevelDict         levelDict = new LevelDict();
            string            state     = string.Empty;

            foreach (var item in result)
            {
                //Get values for all levels from 1-9
                content   = item.attributes.document.descr;
                levelList = GetLevel(item, levelList, levelDict, content);
                state     = levelList.Select(x => x.state).First();

                if (string.IsNullOrEmpty(standardSetName))
                {
                    string level1 = levelList.Where(x => x.levelNumber == 1).Select(y => y.standardText).First();
                    string level2 = levelList.Where(x => x.levelNumber == 2).Select(y => y.standardText).First();
                    string level3 = levelList.Where(x => x.levelNumber == 3).Select(y => y.standardText).First();
                    standardSetName = FormStandardSetName(state, level1, level2, level3);
                }
            }

            standardSetWebCMS.standardSetName = standardSetName;

            if (state == "CC")
            {
                state = "NT";
            }

            standardSetWebCMS.state = state;
            standardSetWebCMS.webCMSLevels.AddRange(levelList);
            return(standardSetWebCMS);
        }
        protected internal LevelDict AssignLevelInformation(int levelNo, Datum item, Guid standardGuid, string standardText, string content)
        {
            LevelDict levelDict = new LevelDict();

            levelDict.levelNumber  = levelNo;
            levelDict.standardGuid = standardGuid;
            levelDict.standardText = standardText;
            KeyValuePair <int?, int?> contentPair = GetContent(content);

            levelDict.contentId      = contentPair.Key;
            levelDict.contentFieldId = contentPair.Value;

            //common values
            levelDict.state = GetState(item);
            if (levelNo > 3)
            {
                levelDict.standardNumber = item.attributes.number.enhanced;
                levelDict.source         = item.attributes.document.publication.descr;
                levelDict.subject        = item.attributes.section.descr;
                levelDict.fromGrade      = item.attributes.education_levels.grades.OrderBy(x => x.seq).Select(f => f.code).First();
                levelDict.toGrade        = item.attributes.education_levels.grades.OrderByDescending(x => x.seq).Select(t => t.code).First();
            }

            return(levelDict);
        }
        protected internal List <LevelDict> GetLevel(Datum item, List <LevelDict> levelList, LevelDict levelDict, string content)
        {
            //Get level1
            levelList = GetLevel1(item, levelList, levelDict, content);
            //Get level2
            levelList = GetLevel2(item, levelList, levelDict, content);
            //Get level3
            levelList = GetLevel3(item, levelList, levelDict, content);
            //Get level4
            levelList = GetLevel4(item, levelList, levelDict, content);

            if (item.attributes.level >= 1 && item.attributes.level <= 4)
            {
                //add levels 5-10 and their relevant key value pairs
                string enhanced = GetEnhanced(item.attributes.number.enhanced, item);
                string standardText;
                standardText = enhanced + " " + item.attributes.statement.descr;

                levelDict = AssignLevelInformation(item.attributes.level + 4, item, Guid.Parse(item.attributes.guid ?? ""), standardText, content);

                //Ignore introduction and practices
                if ((!levelDict.subject.ToLower().Contains("introduction")) && (!levelDict.subject.ToLower().Contains("practices")))
                {
                    levelList.Add(levelDict);
                }
            }

            return(levelList);
        }
 protected internal List <LevelDict> GetLevel3(Datum item, List <LevelDict> level3, LevelDict levelDict, string content)
 {
     levelDict = AssignLevelInformation(3, item, Guid.Parse(item.attributes.section.disciplines.primary_subject.guid), item.attributes.section.disciplines.primary_subject.code + " (" + item.attributes.section.adopt_year + ")", content);
     if (!CheckIfValueExists(level3, levelDict.standardGuid))
     {
         level3.Add(levelDict);
     }
     return(level3);
 }
 protected internal List <LevelDict> GetLevel2(Datum item, List <LevelDict> level2, LevelDict levelDict, string content)
 {
     levelDict = AssignLevelInformation(2, item, Guid.Parse(item.attributes.document.publication.guid), item.attributes.document.publication.descr, content);
     if (!CheckIfValueExists(level2, levelDict.standardGuid))
     {
         level2.Add(levelDict);
     }
     return(level2);
 }
        protected internal List <LevelDict> GetLevel4(Datum item, List <LevelDict> level4, LevelDict levelDict, string content)
        {
            string fromGrade = item.attributes.education_levels.grades.OrderBy(x => x.seq).Select(f => f.code).First();
            string toGrade   = item.attributes.education_levels.grades.OrderByDescending(x => x.seq).Select(t => t.code).First();
            string standardText;

            standardText = fromGrade;

            if ((fromGrade.ToLower().Trim() == "9") || (fromGrade.ToLower().Trim() == "10") || (fromGrade.ToLower().Trim() == "11") || (fromGrade.ToLower().Trim() == "12"))
            {
                if (fromGrade.ToLower().Trim() != toGrade.ToLower().Trim())
                {
                    standardText = fromGrade + "-" + toGrade;
                }
            }
            else
            {
                standardText = fromGrade;
            }

            levelDict = AssignLevelInformation(4, item, Guid.Empty, standardText, content);

            if (!CheckIfGradeExists(level4, standardText))
            {
                if ((!levelDict.subject.ToLower().Contains("introduction")) && (!levelDict.subject.ToLower().Contains("practices")))
                {
                    level4.Add(levelDict);
                }
            }
            return(level4);
        }