Example #1
0
        public override void RefreshCache()
        {
            string hql    = "from ConverImageInfo c where c.IsPublish=1 order by c.Rank";
            var    images = ConverImageInfo.Execute(new HqlReadQuery <ConverImageInfo>(hql)) as IList <ConverImageInfo>;
            var    list   = new List <ConverImageNode>(images.Count);

            foreach (var image in images)
            {
                var result = false;
                if (image.ChannelType == 3)
                {
                    result = ListCache.Instance.Dictionary.ContainsKey(image.ChannelID);
                }
                else if (image.ChannelType == 0)
                {
                    result = LiveListCache.Instance.Dictionary.ContainsKey(image.ChannelID);
                }
                if (result)
                {
                    var node = new ConverImageNode()
                    {
                        Vid         = image.ChannelID,
                        ChannelType = image.ChannelType == 3 ? "vod" : "live",
                        Language    = SimpleLanguageHandler.DoubleProcessLang(image.Title, image.Note),
                        ImageUrl    = image.ImageUrl,
                        OnlineTime  = image.OnlineTime,
                        PlatForms   = PlatformUtils.ConvertPlatForms(image.ChannelID, image.ChannelType)
                    };
                    list.Add(node);
                }
            }
            _cache = list;
        }
Example #2
0
        public override void RefreshCache()
        {
            string hql    = "from ConverImageInfo c where c.IsPublish=1 order by c.Rank";
            var    images = ConverImageInfo.Execute(new HqlReadQuery <ConverImageInfo>(hql)) as List <ConverImageInfo>;
            var    dic    = new Dictionary <int, CoverImageNode>(images.Count);

            foreach (var image in images)
            {
                var node = new CoverImageNode()
                {
                    ImageId     = image.ImageID,
                    ChannelId   = image.ChannelID,
                    ChannelType = image.ChannelType,
                    NavId       = image.NavID,
                    Language    = SimpleLanguageHandler.DoubleProcessLang(image.Title, image.Note),
                    ImageUrl    = image.ImageUrl,
                    OnlineTime  = image.OnlineTime
                };
                dic.Add(image.ImageID, node);
            }
            _cache = dic;
        }