public PartialViewResult BuildTVEContentList(Category category, int ctr = 0)
        {
            List<TVEContentListObj> list = null;
            string jsonString = String.Empty;
            try
            {
                DateTime registDt = DateTime.Now;
                var context = new IPTV2Entities();
                var CountryCode = MyUtility.GetCountryCodeViaIpAddressWithoutProxy();

                var cache = DataCache.Cache;
                string cacheKey = "BTVECL:O:" + category.CategoryId.ToString() + ";C:" + CountryCode;
                try { jsonString = (string)cache[cacheKey]; }
                catch (Exception) { }
                if (String.IsNullOrEmpty(jsonString))
                {
                    if (category != null)
                    {
                        if (category is Category)
                        {
                            var parent = (Category)category;
                            var subCategoryies = parent.SubCategories;
                            if (subCategoryies.Count() > 0)
                            {
                                list = new List<TVEContentListObj>();
                                var service = context.Offerings.Find(GlobalConfig.offeringId).Services.FirstOrDefault(s => s.StatusId == GlobalConfig.Visible);
                                try
                                {
                                    foreach (var subCategory in subCategoryies)
                                    {
                                        try
                                        {
                                            if (subCategory is Category)
                                            {
                                                var obj = new TVEContentListObj()
                                                {
                                                    MainCategory = subCategory.Description,
                                                    MainCategoryId = subCategory.CategoryId,
                                                    shows = new List<ShowD>()
                                                };
                                                var showIds = service.GetAllOnlineShowIds(CountryCode, subCategory);
                                                if (showIds.Count() > 0)
                                                {
                                                    var shows = context.CategoryClasses.Where(c => showIds.Contains(c.CategoryId) && c.StatusId == GlobalConfig.Visible);
                                                    foreach (var item in shows)
                                                    {
                                                        if (item is Show && item.StartDate < registDt && item.EndDate > registDt)
                                                        {
                                                            var show = (Show)item;
                                                            obj.shows.Add(new ShowD() { id = show.CategoryId, name = show.Description });
                                                        }
                                                    }
                                                    if (obj.shows.Count() > 0)
                                                        list.Add(obj);
                                                }
                                            }
                                        }
                                        catch (Exception) { }
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                    jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(list);
                    cache.Put(cacheKey, jsonString, DataCache.CacheDuration);
                }
                else
                    list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TVEContentListObj>>(jsonString);
            }
            catch (Exception e) { MyUtility.LogException(e); }
            ViewBag.Category = category;
            ViewBag.IsActive = ctr == 0 ? true : false;
            return PartialView(list);
        }
        public ActionResult SubmitTicket()
        {
            var context = new IPTV2Entities();
            var faq = (Category)context.CategoryClasses.FirstOrDefault(c => c.CategoryId == GlobalConfig.FAQ && c.StatusId == GlobalConfig.Visible);
            var categories = faq.CategoryClassSubCategories.Where(c => c.SubCategory.StatusId == GlobalConfig.Visible).ToList();
            List<CategoryClass> list = new List<CategoryClass>();
            foreach (var item in categories)
            {
                list.Add(item.SubCategory);
            }

            Category other = new Category()
            {
                Description = "Others"
            };
            list.Add((CategoryClass)other);
            ViewBag.CategoryList = list;
            if (MyUtility.isUserLoggedIn())
            {
                User user = context.Users.FirstOrDefault(u => u.UserId == new System.Guid(User.Identity.Name));
                ViewBag.Email = user.EMail;
            }
            return PartialView("_SubmitTicket");
        }
 public static IEnumerable<int> GetAllShowsBasedOnCountryCode(IPTV2Entities context, string CountryCode, bool addExclusion = false, Offering offering = null, Service service = null, Category category = null)
 {
     SortedSet<int> list = null;
     try
     {
         if (offering == null)
             offering = context.Offerings.Find(GlobalConfig.offeringId);
         if (service == null)
             service = offering.Services.FirstOrDefault(s => s.PackageId == GlobalConfig.serviceId);
         if (category != null)
             list = service.GetAllOnlineShowIds(CountryCode, category);
         else
             list = service.GetAllOnlineShowIds(CountryCode);
         if (addExclusion)
         {
             if (list != null)
             {
                 var excludedCategoryIds = MyUtility.StringToIntList(GlobalConfig.ExcludedCategoryIdsForDisplay);
                 var result = list.Except(excludedCategoryIds);
                 return result;
             }
         }
         if (list != null)
             return list.ToList();
     }
     catch (Exception) { }
     return null;
 }