Beispiel #1
0
        /// <summary>
        /// Возвращает список по ids
        /// </summary>
        /// <returns></returns>
        internal static IEnumerable <StatusType> GetList(IEnumerable <int> IDs)
        {
            var result = new List <StatusType>();
            var cache  = QPContext.GetStatusTypeCache();

            if (cache != null)
            {
                foreach (var id in IDs)
                {
                    if (cache.ContainsKey(id))
                    {
                        result.Add(cache[id]);
                    }
                    else
                    {
                        result.Add(GetRealById(id));
                    }
                }
            }
            else
            {
                IEnumerable <decimal> decIDs = Converter.ToDecimalCollection(IDs).Distinct().ToArray();
                result = MapperFacade.StatusTypeMapper
                         .GetBizList(QPContext.EFContext.StatusTypeSet
                                     .Where(f => decIDs.Contains(f.Id))
                                     .ToList()
                                     );
            }

            return(result);
        }
Beispiel #2
0
        internal static StatusType GetByIdFromCache(int id)
        {
            StatusType result = null;
            var        cache  = QPContext.GetStatusTypeCache();

            if (cache != null && cache.ContainsKey(id))
            {
                result = cache[id];
            }
            return(result);
        }