Exemplo n.º 1
0
 public static ThemeType ConvertToThemeType(IUDICO.Common.Models.Shared.ThemeType themeType)
 {
     switch (themeType.Name)
     {
         case "Test":return ThemeType.Test;
         case "Theory":return ThemeType.Theory;
         case "TestWithoutCourse": return ThemeType.TestWithoutCourse;
         default: throw new ArgumentOutOfRangeException();
     }
 }
Exemplo n.º 2
0
 public static string ConvertToString(IUDICO.Common.Models.Shared.ThemeType themeType)
 {
     ThemeType enumThemeType = ConvertToThemeType(themeType);
     switch (enumThemeType)
     {
         case ThemeType.Test: return Localization.getMessage("ThemeType.Test");
         case ThemeType.Theory: return Localization.getMessage("ThemeType.Theory");
         case ThemeType.TestWithoutCourse: return  Localization.getMessage("ThemeType.TestWithoutCourse");
         default: throw new ArgumentOutOfRangeException();
     }
 }
Exemplo n.º 3
0
 public static string ToString(IUDICO.Common.Models.Shared.TopicType topicType)
 {
     TopicTypeEnum enumTopicType = ToTopicType(topicType);
     switch (enumTopicType)
     {
         case TopicTypeEnum.Test: return Localization.getMessage("TopicType.Test");
         case TopicTypeEnum.Theory: return Localization.getMessage("TopicType.Theory");
         case TopicTypeEnum.TestWithoutCourse: return Localization.getMessage("TopicType.TestWithoutCourse");
         default: throw new ArgumentOutOfRangeException();
     }
 }
Exemplo n.º 4
0
        public static void ProcessNode(IndexWriter writer, IUDICO.Common.Models.Shared.Node node, ICourseService courseService)
        {
            Document document = new Document();
            document.Add(new Field("Type", "Node", Field.Store.YES, Field.Index.NO));
            document.Add(new Field("NodeID", node.Id.ToString(), Field.Store.YES, Field.Index.ANALYZED));
            document.Add(new Field("Name", node.Name, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
            document.Add(new Field("NodeCourseID", node.CourseId.ToString(), Field.Store.YES, Field.Index.ANALYZED));
            document.Add(new Field("isFolder", node.IsFolder.ToString(), Field.Store.YES, Field.Index.ANALYZED));

            if (node.IsFolder)
            {
                var nodes = courseService.GetNodes(node.CourseId, node.Id);

                foreach (IUDICO.Common.Models.Shared.Node childNode in nodes)
                {
                    ProcessNode(writer, childNode, courseService);
                }
            }
            else
            {
                var content = courseService.GetNodeContents(node.Id);

                document.Add(new Field("Content", content, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
            }

            writer.AddDocument(document);
        }