Ejemplo n.º 1
0
        /// <summary>
        /// Gets the by entity.
        /// </summary>
        /// <param name="entityTypeid">The entity typeid.</param>
        /// <param name="entityTypeQualifierColumn">The entity type qualifier column.</param>
        /// <param name="entityTypeQualifierValue">The entity type qualifier value.</param>
        /// <param name="includeNonSelectable">if set to <c>true</c> [include non selectable].</param>
        /// <returns></returns>
        public static List <NoteTypeCache> GetByEntity(int?entityTypeid, string entityTypeQualifierColumn, string entityTypeQualifierValue, bool includeNonSelectable = false)
        {
            var allEntityNoteTypes = EntityNoteTypesCache.Get();

            if (allEntityNoteTypes == null)
            {
                return(new List <NoteTypeCache>());
            }

            var matchingNoteTypeIds = allEntityNoteTypes.EntityNoteTypes
                                      .Where(a => a.EntityTypeId.Equals(entityTypeid))
                                      .ToList()
                                      .Where(a =>
                                             (a.EntityTypeQualifierColumn ?? string.Empty) == (entityTypeQualifierColumn ?? string.Empty) &&
                                             (a.EntityTypeQualifierValue ?? string.Empty) == (entityTypeQualifierValue ?? string.Empty))
                                      .SelectMany(a => a.NoteTypeIds)
                                      .ToList();

            var noteTypes = new List <NoteTypeCache>();

            foreach (var noteTypeId in matchingNoteTypeIds)
            {
                var noteType = Get(noteTypeId);
                if (noteType != null && (includeNonSelectable || noteType.UserSelectable))
                {
                    noteTypes.Add(noteType);
                }
            }

            return(noteTypes);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Flushes the entity noteTypes.
 /// </summary>
 public static void RemoveEntityNoteTypes()
 {
     EntityNoteTypesCache.Remove();
 }