Exemplo n.º 1
0
        public JsonResult GetSiteMenu()
        {
            Response.Filter = new GZipStream(Response.Filter, CompressionMode.Compress);
            int[] mainMenuIds = { 736, 738, 737 };
            List<MyMainMenu> siteMenus = null;
            string jsonString = String.Empty;
            var cache = DataCache.Cache;
            string cacheKey = "SYNGETSITEMENU:0:";
            try { jsonString = (string)cache[cacheKey]; }
            catch (Exception) { }
            if (String.IsNullOrEmpty(jsonString))
            {
                siteMenus = new List<MyMainMenu>();
                foreach (int mainMenuId in mainMenuIds)
                {
                    var context = new IPTV2Entities();
                    Category mainCategory = (Category)context.CategoryClasses.FirstOrDefault(c => c.CategoryId == mainMenuId);
                    List<MyMenu> fullMenu = new List<MyMenu>();
                    string id = String.Format("{0}MenuIds", mainCategory.Description);
                    string menuId = ConfigurationManager.AppSettings[id];
                    var menuids = MyUtility.StringToIntList(menuId);

                    var features = context.Features.Where(f => menuids.Contains(f.FeatureId) && f.StatusId == GlobalConfig.Visible).ToList();

                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuids)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }
                    //var ordered = menuids.Select(i => d[i]).ToList();

                    foreach (var feature in ordered)
                    {
                        var temp = feature.Description.Split('|');

                        var featureItems = feature.FeatureItems.Where(f => f.MobileStatusId == GlobalConfig.Visible);
                        List<MyMenuShows> mms = new List<MyMenuShows>();
                        foreach (var f in featureItems)
                        {
                            if (f is ShowFeatureItem)
                            {
                                ShowFeatureItem sft = (ShowFeatureItem)f;
                                var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == sft.CategoryId);
                                if (category != null)
                                {
                                    if (category is Show)
                                    {
                                        Show show = sft.Show;
                                        string img = String.IsNullOrEmpty(show.ImagePoster) ? GlobalConfig.AssetsBaseUrl + GlobalConfig.BlankGif : String.Format("{0}{1}/{2}", GlobalConfig.ShowImgPath, show.CategoryId.ToString(), show.ImagePoster);
                                        MyMenuShows m = new MyMenuShows() { name = show.Description, id = show.CategoryId, image = img };
                                        mms.Add(m);
                                    }
                                }
                            }
                        }

                        MyMenu item = new MyMenu()
                        {
                            name = temp[0],
                            id = Convert.ToInt32(temp[1]),
                            shows = mms
                        };

                        if (item.shows.Count > 0)
                            fullMenu.Add(item);
                    }
                    MyMainMenu siteMenu = new MyMainMenu()
                    {
                        id = mainCategory.CategoryId,
                        name = mainCategory.Description,
                        menu = fullMenu
                    };
                    siteMenus.Add(siteMenu);
                }

                var cacheDuration = new TimeSpan(0, GlobalConfig.MenuCacheDuration, 0);
                jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(siteMenus);
                cache.Put(cacheKey, jsonString, cacheDuration);
            }
            else
                siteMenus = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MyMainMenu>>(jsonString);
            return Json(siteMenus, JsonRequestBehavior.AllowGet);
        }
        public void FillCache(IPTV2Entities context, int offeringId, int serviceId, TimeSpan cacheDuration, string[] listOfMenuNames)
        {
            List<MyMenu> fullMenu = null;
            //var MenuMovieBlurbLength = Convert.ToInt32(RoleEnvironment.GetConfigurationSettingValue("MenuMovieBlurbLength"));
            //var MenuShowBlurbLength = Convert.ToInt32(RoleEnvironment.GetConfigurationSettingValue("MenuShowBlurbLength"));
            //var EpisodeImgPath = RoleEnvironment.GetConfigurationSettingValue("EpisodeImgPath");
            //var ShowImgPath = RoleEnvironment.GetConfigurationSettingValue("ShowImgPath");
            //var BlankGif = RoleEnvironment.GetConfigurationSettingValue("BlankGif");
            //var AssetsBaseUrl = RoleEnvironment.GetConfigurationSettingValue("AssetsBaseUrl");
            DateTime registDt = DateTime.Now;
            try
            {
                foreach (var menuName in listOfMenuNames)
                {
                    fullMenu = new List<MyMenu>();
                    ///////////////////
                    string menuId = String.Format("{0}MenuIds", menuName);
                    var menuIdList = StringToIntList(RoleEnvironment.GetConfigurationSettingValue(menuId));
                    var features = context.Features.Where(f => menuIdList.Contains(f.FeatureId) && f.StatusId == isVisible).ToList();
                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuIdList)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }

                    var featureCountCorrection = 0;
                    var featurewithShowcount = 0;
                    foreach (var feature in ordered)
                    {
                        var temp = feature.Description.Split('|');
                        int takeAmount = 5;
                        try { takeAmount = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 5; takeAmount = takeAmount > 0 ? takeAmount : 5; }
                        catch (Exception) { }
                        MyMenu item = new MyMenu()
                        {
                            name = temp[0],
                            id = Convert.ToInt32(temp[1]),
                            type = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 0
                        };
                        int showCount = takeAmount - 1;
                        try
                        {
                            var categoryId = Convert.ToInt32(temp[1]);
                            var countryCode = "US";
                            var offering = context.Offerings.Find(offeringId);
                            var service = offering.Services.FirstOrDefault(s => s.PackageId == serviceId);
                            if (service != null)
                            {
                                var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == categoryId);
                                var showIds = service.GetAllOnlineShowIds(countryCode, (Category)category);
                                showCount = showIds.Count();
                            }
                        }
                        catch (Exception) { }
                        item.showcount = showCount;
                        if (ordered.IndexOf(feature) < 4 || (ordered.IndexOf(feature) - 3) == featureCountCorrection)
                        {
                            var featureItems = feature.FeatureItems.Where(f => f.StatusId == isVisible).ToList();
                            List<MyMenuShows> mms = new List<MyMenuShows>();
                            int ctr = 0;
                            foreach (var f in featureItems.Where(fI => fI.StatusId == isVisible))
                            {
                                if (f is ShowFeatureItem)
                                {
                                    var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == ((ShowFeatureItem)f).CategoryId);
                                    if (category != null)
                                    {
                                        if (category is Show && category.StartDate < registDt && category.EndDate > registDt && category.StatusId == isVisible)
                                        {
                                            Show show = (Show)category;
                                            MyMenuShows m = new MyMenuShows()
                                            {
                                                name = show.Description,
                                                id = show.CategoryId
                                            };
                                            if (takeAmount > ctr)
                                            { mms.Add(m); ctr++; }
                                            else ctr++;
                                        }
                                    }
                                }
                            }
                            item.shows = mms;
                            if (item.shows == null || item.shows.Count == 0)
                                featureCountCorrection += 1;
                            else
                                featurewithShowcount += 1;
                        }
                        if (item.shows != null)
                        {
                            if (item.shows.Count > 0 && featurewithShowcount <= 4)
                                fullMenu.Add(item);
                        }
                        else if (featurewithShowcount >= 4)
                            fullMenu.Add(item);
                    }

                    ///////////////
                    var cacheKey = GetMenuGroupCacheKey(menuName);
                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(fullMenu);
                    IPTV2_Model.DataCache.Cache.Put(cacheKey, jsonString, cacheDuration);
                }
            }
            catch (Exception e) { Trace.TraceError("MenuGroupCacheRefresher Cache - Error! " + e.Message); }
        }
Exemplo n.º 3
0
        //
        // GET: /Synapse/

        //[OutputCache(VaryByParam = "id", Duration = 60)]
        public JsonResult GetMenu(string id)
        {
            List<MyMenu> fullMenu = null;
            var cache = DataCache.Cache;
            string cacheKey = "SYNAPSEGMenu:O:" + id;
            fullMenu = (List<MyMenu>)cache[cacheKey];

            if (fullMenu == null)
            {
                fullMenu = new List<MyMenu>();
                if (String.IsNullOrEmpty(id))
                    id = "Entertainment";
                id = id + "MenuIds";
                string menuId = ConfigurationManager.AppSettings[id];
                var menuids = MyUtility.StringToIntList(menuId);

                var context = new IPTV2Entities();
                var features = context.Features.Where(f => menuids.Contains(f.FeatureId) && f.StatusId == GlobalConfig.Visible).ToList();

                Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                List<Feature> ordered = new List<Feature>();
                foreach (var i in menuids)
                {
                    if (d.ContainsKey(i))
                        ordered.Add(d[i]);
                }
                //var ordered = menuids.Select(i => d[i]).ToList();

                foreach (var feature in ordered)
                {
                    var temp = feature.Description.Split('|');

                    var fItems = feature.FeatureItems.Where(f => f.MobileStatusId == GlobalConfig.Visible);
                    if (fItems != null)
                    {
                        var featureItems = fItems.ToList();
                        List<MyMenuShows> mms = new List<MyMenuShows>();
                        foreach (ShowFeatureItem f in featureItems)
                        {
                            if (f is ShowFeatureItem)
                            {
                                Show show = f.Show;
                                MyMenuShows m = new MyMenuShows() { name = show.Description, id = show.CategoryId };
                                mms.Add(m);
                            }
                        }
                        MyMenu item = new MyMenu()
                        {
                            name = temp[0],
                            id = Convert.ToInt32(temp[1]),
                            shows = mms
                        };

                        if (item.shows.Count > 0)
                            fullMenu.Add(item);
                    }
                }
                var cacheDuration = new TimeSpan(0, GlobalConfig.SynapseGenericCacheDuration, 0);
                cache.Put(cacheKey, fullMenu, cacheDuration);
            }
            return Json(fullMenu, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 4
0
        //[OutputCache(VaryByParam = "id", Duration = 180)]
        public List<MyMenu> BuildMenuGroup(string id)
        {
            List<MyMenu> fullMenu = null;
            string jsonString = String.Empty;
            try
            {
                var cache = DataCache.Cache;
                string cacheKey = "JRBMG:O:" + id + ";C:";// +MyUtility.getCountry(Request.GetUserHostAddressFromCloudflare()).getCode();
                var registDt = DateTime.Now;
                try { jsonString = (string)cache[cacheKey]; }
                catch (Exception) { }
                if (String.IsNullOrEmpty(jsonString))
                {
                    fullMenu = new List<MyMenu>();
                    if (String.IsNullOrEmpty(id))
                        id = "Entertainment";
                    id = id + "MenuIds";
                    string menuId = Settings.GetSettings(id);
                    var menuIdList = MyUtility.StringToIntList(menuId);

                    var context = new IPTV2Entities();
                    var features = context.Features.Where(f => menuIdList.Contains(f.FeatureId) && f.StatusId == GlobalConfig.Visible).ToList();

                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuIdList)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }
                    foreach (var feature in ordered)
                    {
                        try
                        {
                            var temp = feature.Description.Split('|');
                            int takeAmount = 5;
                            try { takeAmount = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 5; takeAmount = takeAmount > 0 ? takeAmount : 5; }
                            catch (Exception) { }
                            var featureItems = feature.FeatureItems.Where(f => f.StatusId == GlobalConfig.Visible).Take(takeAmount).ToList();
                            List<MyMenuShows> mms = new List<MyMenuShows>();
                            foreach (var f in featureItems.Where(fI => fI.StatusId == GlobalConfig.Visible))
                            {
                                if (f is ShowFeatureItem)
                                {
                                    var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == ((ShowFeatureItem)f).CategoryId);
                                    if (category != null)
                                    {
                                        if (category is Show && category.StartDate < registDt && category.EndDate > registDt && category.StatusId == GlobalConfig.Visible)
                                        {
                                            Show show = (Show)category;
                                            MyMenuShows m = new MyMenuShows()
                                            {
                                                name = show.Description,
                                                id = show.CategoryId
                                            };
                                            mms.Add(m);
                                        }
                                    }
                                }
                            }

                            MyMenu item = new MyMenu()
                            {
                                name = temp[0],
                                id = Convert.ToInt32(temp[1]),
                                //type = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 0,
                                shows = mms
                            };
                            if (item.shows.Count > 0)
                                fullMenu.Add(item);
                        }
                        catch (Exception) { }
                    }
                    var cacheDuration = new TimeSpan(0, GlobalConfig.MenuCacheDuration, 0);
                    jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(fullMenu);
                    cache.Put(cacheKey, jsonString, cacheDuration);
                }
                else
                    fullMenu = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MyMenu>>(jsonString);
            }
            catch (Exception e) { MyUtility.LogException(e); }
            return fullMenu;
        }
Exemplo n.º 5
0
        public PartialViewResult BuildUXMenuV2(string id = "Entertainment", bool isDesktop = true)
        {
            List<MyMenu> fullMenu = null;
            string jsonString = String.Empty;
            try
            {
                var cache = DataCache.Cache;
                string cacheKey = "UXBMG:O:" + id + ";C:";// +MyUtility.getCountry(Request.GetUserHostAddressFromCloudflare()).getCode();
                var registDt = DateTime.Now;
                try { jsonString = (string)cache[cacheKey]; }
                catch (Exception) { }
                if (String.IsNullOrEmpty(jsonString))
                {
                    fullMenu = new List<MyMenu>();
                    if (String.IsNullOrEmpty(id))
                        id = "Entertainment";
                    id = id + "MenuIds";
                    string menuId = Settings.GetSettings(id);
                    var menuIdList = MyUtility.StringToIntList(menuId);

                    var context = new IPTV2Entities();
                    var features = context.Features.Where(f => menuIdList.Contains(f.FeatureId) && f.StatusId == GlobalConfig.Visible).ToList();

                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuIdList)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }

                    var featureCountCorrection = 0;
                    var featurewithShowcount = 0;
                    foreach (var feature in ordered)
                    {
                        try
                        {
                            var temp = feature.Description.Split('|');
                            int takeAmount = 5;
                            try { takeAmount = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 5; takeAmount = takeAmount > 0 ? takeAmount : 5; }
                            catch (Exception) { }
                            // get number of shows inside the category

                            MyMenu item = new MyMenu()
                            {
                                name = temp[0],
                                id = Convert.ToInt32(temp[1])
                            };
                            int showCount = takeAmount - 1;
                            try
                            {
                                var categoryId = Convert.ToInt32(temp[1]);
                                var countryCode = GlobalConfig.DefaultCountry;
                                var offering = context.Offerings.Find(GlobalConfig.offeringId);
                                var service = offering.Services.FirstOrDefault(s => s.PackageId == GlobalConfig.serviceId);
                                if (service != null)
                                {
                                    var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == categoryId);
                                    var showIds = service.GetAllOnlineShowIds(countryCode, (Category)category);
                                    showCount = showIds.Count();
                                }
                            }
                            catch (Exception) { }
                            item.showcount = showCount;
                            if (!String.IsNullOrEmpty(item.name)) item.name = item.name.TrimEnd();
                            if (ordered.IndexOf(feature) < 4 || (ordered.IndexOf(feature) - 3) == featureCountCorrection)
                            {
                                var featureItems = feature.FeatureItems.Where(f => f.StatusId == GlobalConfig.Visible).ToList();
                                List<MyMenuShows> mms = new List<MyMenuShows>();
                                int ctr = 0;
                                foreach (var f in featureItems.Where(fI => fI.StatusId == GlobalConfig.Visible))
                                {
                                    if (f is ShowFeatureItem)
                                    {
                                        var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == ((ShowFeatureItem)f).CategoryId);
                                        if (category != null)
                                        {
                                            if (category is Show && category.StartDate < registDt && category.EndDate > registDt && category.StatusId == GlobalConfig.Visible)
                                            {
                                                Show show = (Show)category;
                                                MyMenuShows m = new MyMenuShows()
                                                {
                                                    name = show.Description,
                                                    id = show.CategoryId
                                                };
                                                if (takeAmount > ctr)
                                                { mms.Add(m); ctr++; }
                                                else ctr++;
                                            }
                                        }
                                    }
                                }
                                item.shows = mms;
                                if (item.shows == null || item.shows.Count == 0)
                                    featureCountCorrection += 1;
                                else
                                    featurewithShowcount += 1;

                            }
                            if (item.shows != null)
                            {
                                if (item.shows.Count > 0 && featurewithShowcount <= 4)
                                    fullMenu.Add(item);
                            }
                            else if (featurewithShowcount >= 4)
                                fullMenu.Add(item);

                        }
                        catch (Exception) { }
                    }
                    var cacheDuration = new TimeSpan(0, GlobalConfig.MenuCacheDuration, 0);
                    jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(fullMenu);
                    cache.Put(cacheKey, jsonString, cacheDuration);
                }
                else
                    fullMenu = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MyMenu>>(jsonString);
                ViewBag.IsDesktop = isDesktop;
            }
            catch (Exception e) { MyUtility.LogException(e); }
            return PartialView(fullMenu);
        }
Exemplo n.º 6
0
        public PartialViewResult BuildUXMenu(string id = "Entertainment", bool isDesktop = true)
        {
            List<MyMenu> fullMenu = null;
            string jsonString = String.Empty;
            try
            {
                var cache = DataCache.Cache;
                string cacheKey = "UXBMG:O:" + id + ";C:";// +MyUtility.getCountry(Request.GetUserHostAddressFromCloudflare()).getCode();
                var registDt = DateTime.Now;
                try { jsonString = (string)cache[cacheKey]; }
                catch (Exception) { }
                if (String.IsNullOrEmpty(jsonString))
                {
                    fullMenu = new List<MyMenu>();
                    if (String.IsNullOrEmpty(id))
                        id = "Entertainment";
                    id = id + "MenuIds";
                    string menuId = Settings.GetSettings(id);
                    var menuIdList = MyUtility.StringToIntList(menuId);

                    var context = new IPTV2Entities();
                    var features = context.Features.Where(f => menuIdList.Contains(f.FeatureId) && f.StatusId == GlobalConfig.Visible).ToList();

                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuIdList)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }
                    foreach (var feature in ordered)
                    {
                        try
                        {
                            var temp = feature.Description.Split('|');
                            MyMenu item = new MyMenu()
                            {
                                name = temp[0],
                                id = Convert.ToInt32(temp[1])
                            };
                            if (!String.IsNullOrEmpty(item.name)) item.name = item.name.TrimEnd();
                            fullMenu.Add(item);
                        }
                        catch (Exception) { }
                    }
                    var cacheDuration = new TimeSpan(0, GlobalConfig.MenuCacheDuration, 0);
                    jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(fullMenu);
                    cache.Put(cacheKey, jsonString, cacheDuration);
                }
                else
                    fullMenu = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MyMenu>>(jsonString);
                ViewBag.IsDesktop = isDesktop;
            }
            catch (Exception e) { MyUtility.LogException(e); }
            return PartialView(fullMenu);
        }
        private void FillSiteMenu(IPTV2Entities context, TimeSpan cacheDuration)
        {
            int[] mainMenuIds = { 736, 738, 737 };
            string cacheKey = "SYNGETSITEMENU:0:";
            try
            {
                List<MyMainMenu> siteMenus = new List<MyMainMenu>();
                foreach (int mainMenuId in mainMenuIds)
                {
                    Category mainCategory = (Category)context.CategoryClasses.FirstOrDefault(c => c.CategoryId == mainMenuId);
                    List<MyMenu> fullMenu = new List<MyMenu>();
                    string id = String.Format("{0}MenuIds", mainCategory.Description);
                    string menuId = RoleEnvironment.GetConfigurationSettingValue(id);
                    var menuids = StringToIntList(menuId);
                    var features = context.Features.Where(f => menuids.Contains(f.FeatureId) && f.StatusId == Visible).ToList();

                    Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                    List<Feature> ordered = new List<Feature>();
                    foreach (var i in menuids)
                    {
                        if (d.ContainsKey(i))
                            ordered.Add(d[i]);
                    }

                    foreach (var feature in ordered)
                    {
                        var temp = feature.Description.Split('|');

                        var featureItems = feature.FeatureItems.Where(f => f.MobileStatusId == Visible);
                        List<MyMenuShows> mms = new List<MyMenuShows>();
                        foreach (var f in featureItems)
                        {
                            if (f is ShowFeatureItem)
                            {
                                ShowFeatureItem sft = (ShowFeatureItem)f;
                                var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == sft.CategoryId);
                                if (category != null)
                                {
                                    if (category is Show)
                                    {
                                        Show show = sft.Show;
                                        string img = String.IsNullOrEmpty(show.ImagePoster) ? AssetsBaseUrl + BlankGif : String.Format("{0}{1}/{2}", ShowImgPath, show.CategoryId.ToString(), show.ImagePoster);
                                        MyMenuShows m = new MyMenuShows() { name = show.Description, id = show.CategoryId, image = img };
                                        mms.Add(m);
                                    }
                                }
                            }
                        }
                        MyMenu item = new MyMenu()
                        {
                            name = temp[0],
                            id = Convert.ToInt32(temp[1]),
                            shows = mms
                        };

                        if (item.shows.Count > 0)
                            fullMenu.Add(item);
                    }
                    MyMainMenu siteMenu = new MyMainMenu()
                    {
                        id = mainCategory.CategoryId,
                        name = mainCategory.Description,
                        menu = fullMenu
                    };
                    siteMenus.Add(siteMenu);
                }
                var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(siteMenus);                
                DataCache.Cache.Put(cacheKey, jsonString, cacheDuration);
            }
            catch (Exception) { }
        }
Exemplo n.º 8
0
        public static void FillMenuCache()
        {
            var context = new IPTV2Entities();
            var cacheDuration = new TimeSpan(0, 60, 0);
            string[] listOfMenuNames = new string[] { "Entertainment", "News", "Movies", "Live" };
            List<MyMenu> fullMenu = null;

            foreach (var menuName in listOfMenuNames)
            {
                fullMenu = new List<MyMenu>();

                string menuId = String.Format("{0}MenuIds", menuName);
                var listOfIdsUnderMenuId = StringToIntList(ConfigurationManager.AppSettings[menuId]);
                var features = context.Features.Where(f => listOfIdsUnderMenuId.Contains(f.FeatureId) && f.StatusId == 1).ToList();
                Dictionary<int, Feature> d = features.ToDictionary(x => x.FeatureId);
                List<Feature> ordered = new List<Feature>();
                foreach (var i in listOfIdsUnderMenuId)
                {
                    if (d.ContainsKey(i))
                        ordered.Add(d[i]);
                }
                foreach (var feature in ordered)
                {
                    var temp = feature.Description.Split('|');

                    var featureItems = feature.FeatureItems.Where(f => f.StatusId == 1).ToList();
                    List<MyMenuShows> mms = new List<MyMenuShows>();
                    foreach (var f in featureItems)
                    {
                        if (f is ShowFeatureItem)
                        {
                            var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == ((ShowFeatureItem)f).CategoryId);
                            if (category != null)
                            {
                                if (category is Show)
                                {
                                    Show show = (Show)category;
                                    MyMenuShows m = new MyMenuShows() { name = show.Description, id = show.CategoryId };
                                    mms.Add(m);
                                }
                            }
                        }
                        else if (f is ChannelFeatureItem)
                        {
                            var channel = context.Channels.FirstOrDefault(c => c.ChannelId == ((ChannelFeatureItem)f).ChannelId);
                            if (channel != null)
                            {
                                if (channel is Channel)
                                {
                                    Channel ch = (Channel)channel;
                                    MyMenuShows m = new MyMenuShows() { id = ch.ChannelId, name = ch.Description, type = (int)MenuShow.Channel };
                                    mms.Add(m);
                                }
                            }
                        }
                    }

                    MyMenu item = new MyMenu()
                    {
                        name = temp[0],
                        id = Convert.ToInt32(temp[1]),
                        type = temp.Length > 3 ? Convert.ToInt32(temp[3]) : 0,
                        shows = mms
                    };

                    if (item.shows.Count > 0)
                        fullMenu.Add(item);
                }

                var cacheKey = GetMenuGroupCacheKey(menuName);
                DataCache.Cache.Put(cacheKey, fullMenu, cacheDuration);
            }
        }