protected override ElementBase CreateInternal(
            int id,
            ElementType elementType)
        {
            switch (elementType)
            {
            case ElementType.Topic:
                return(Elements[id] = new Topic(id));

            case ElementType.Item:
                return(Elements[id] = new Item(id));

            case ElementType.ConceptGroup:
                return(Elements[id] = new ConceptGroup(id));

            case ElementType.Task:
                return(Elements[id] = new Task(id));
            }

#if DEBUG
            throw new InvalidDataException("Unknown object type");
#else
            return(new Topic(id));
#endif
        }
Esempio n. 2
0
        /// <summary>
        /// Fetches all terms with a matching language
        /// </summary>
        /// <param name="conceptGroup"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        private List <TermGroup> GetTargetTerms(ConceptGroup conceptGroup, string language)
        {
            var result = conceptGroup
                         .Translations
                         .Where(t => t.Language.TwoLetterLanguageCode.Equals(language, StringComparison.OrdinalIgnoreCase))
                         .SelectMany(t => t.TermGroups)
                         .ToList();

            return(result);
        }
Esempio n. 3
0
        protected override ElementBase CreateInternal(
            int id,
            ElementType elementType)
        {
            switch (elementType)
            {
            case ElementType.Topic:
                return(Elements[id] = new Topic(id));

            case ElementType.Item:
                return(Elements[id] = new Item(id));

            case ElementType.ConceptGroup:
                return(Elements[id] = new ConceptGroup(id));

            case ElementType.Task:
                return(Elements[id] = new Task(id));
            }

            LogTo.Warning("Creating element with unknown type {ElementType} for element id {Id}", elementType, id);

            return(new Topic(id));
        }