Beispiel #1
0
        /// <summary>
        /// Возвращает тип объектов для идентификатора <paramref name="type"/>.
        /// </summary>
        /// <param name="type">Идентификатор, для которого следует получить тип объектов.</param>
        public static ItemType GetItemType(int type)
        {
            if (type <= 0)
            {
                return(NotFound);
            }

            var _r = ItemTypes.Where(x => x.Value.IdItemType == type).Select(x => x.Value).FirstOrDefault();

            if (_r == null)
            {
                using (var db = new Db.DataContext())
                    using (var scope = db.CreateScope(TransactionScopeOption.Suppress))
                        _r = db.ItemType.Where(x => x.IdItemType == type).FirstOrDefault();
            }

            if (_r != null)
            {
                return(_r);
            }

            return(NotFound);
        }
Beispiel #2
0
 public virtual Dictionary <ItemType, DisplayMode> GetDefaultDisplayMode()
 {
     return((from i in Enum.GetValues(typeof(ItemType)).OfType <ItemType>() where i != ItemType.None && i != ItemType.RootFolder select i).ToDictionary(i => i, i => ((ItemTypes == null || !ItemTypes.Where(x => x.Type == i && x.Deleted == DomainModel.BaseStatusDeleted.None).Any()) ? DisplayMode.downloadOrPlay : ItemTypes.Where(x => x.Type == i && x.Deleted == DomainModel.BaseStatusDeleted.None).Select(x => x.DefaultDisplayMode).FirstOrDefault())));
 }
Beispiel #3
0
 public virtual Dictionary <ItemType, Boolean> GetDefaultAllowDownload()
 {
     return((from i in Enum.GetValues(typeof(ItemType)).OfType <ItemType>() where i != ItemType.None && i != ItemType.RootFolder select i).ToDictionary(i => i, i => (i != ItemType.Folder && (ItemTypes == null || !ItemTypes.Where(x => x.Type == i && x.Deleted == DomainModel.BaseStatusDeleted.None && !x.AllowDownload).Any()))));
 }
Beispiel #4
0
 public List <ItemType> GoodStock()
 {
     return(ItemTypes.Where(i => i.StockAvailable() == "Bom Stock").ToList());
 }
Beispiel #5
0
 public List <ItemType> MediumStock()
 {
     return(ItemTypes.Where(i => i.StockAvailable() == "Próximo do Limite").ToList());
 }
Beispiel #6
0
 public List <ItemType> LowStock()
 {
     return(ItemTypes.Where(i => i.StockAvailable() == "Abaixo do Limite").ToList());
 }