public static bool CheckUser_Entitlement(Show model) { if (!HttpContext.Current.User.Identity.IsAuthenticated) { return false; } else { using (IPTV2Entities context = new IPTV2Entities()) { Guid userID = new Guid(HttpContext.Current.User.Identity.Name); var user = context.Users.FirstOrDefault(u => u.UserId == userID); var off = context.Offerings.Find(GlobalConfig.offeringId); if (user.IsShowEntitled(off, model, RightsType.Online)) { if (user.Entitlements.Where(t => t.OfferingId == GlobalConfig.offeringId && t.EndDate >= DateTime.Now).Count() > 0) { return true; } } } } return false; }
public PartialViewResult GetCastMembersLink(Show show) { try { var celebrities = show.CelebrityRoles.Where(cr => cr.Celebrity.StatusId == GlobalConfig.Visible).Select(c => c.Celebrity); if (celebrities != null) { var names = celebrities.Select(c => String.Format("<a href=\"{0}/Celebrity/Profile/{1}\">{2}</a>", GlobalConfig.baseUrl, c.CelebrityId, c.FullName)); return PartialView("_GetCastMembers", string.Join(", ", names)); } } catch (Exception) { } return PartialView("_GetCastMembers", String.Empty); }
//[RequireHttp] //public ActionResult Details2(int? id, string slug) //{ // var profiler = MiniProfiler.Current; // var registDt = DateTime.Now; // try // { // if (id != null) // { // if (id == GlobalConfig.TFCkatCategoryId) // return Redirect("/TFCkat"); // else if (id == GlobalConfig.UAAPGreatnessNeverEndsCategoryId) // return RedirectToActionPermanent("Index", "UAAP"); // else if (id == GlobalConfig.FPJCategoryId) // return RedirectToActionPermanent("Index", "FPJ"); // string CountryCode = MyUtility.GetCountryCodeViaIpAddressWithoutProxy(); // var context = new IPTV2Entities(); // User user = null; // if (User.Identity.IsAuthenticated) // { // var UserId = new Guid(User.Identity.Name); // user = context.Users.FirstOrDefault(u => u.UserId == UserId); // if (user != null) // CountryCode = user.CountryCode; // } // //Check if CategoryId is part of the service // var ShowListBasedOnCountryCode = ContextHelper.GetAllShowsBasedOnCountryCode(context, CountryCode, true); // if (!ShowListBasedOnCountryCode.Contains((int)id)) // return RedirectToAction("Index", "Home"); // var category = context.CategoryClasses.FirstOrDefault(c => c.CategoryId == id); // if (category != null) // { // if (category.StatusId == GlobalConfig.Visible) // { // ViewBag.Loved = false; ViewBag.Rated = false; // Social // ViewBag.HasActiveSubscriptionBasedOnCategoryId = new CheckSubscriptionReturnObject() { HasSubscription = false, Within5DaysOrLess = false }; // if (category is Show) // { // var dbSlug = MyUtility.GetSlug(category.Description); // if (String.Compare(dbSlug, slug, false) != 0) // return RedirectToActionPermanent("Details", new { id = id, slug = dbSlug }); // var show = (Show)category; // if (show.StartDate < registDt && show.EndDate > registDt) // { // string CountryCodeTemp = MyUtility.GetCountryCodeViaIpAddressWithoutProxy(); // if (User.Identity.IsAuthenticated) // { // if (user != null) // { // var allowedEmails = GlobalConfig.EmailsAllowedToBypassIPBlock.Split(','); // var isEmailAllowed = allowedEmails.Contains(user.EMail.ToLower()); // ViewBag.EmailAddress = user.EMail; // ViewBag.UserId = user.UserId; // ViewBag.CountryCode = CountryCode; // if (!ContextHelper.IsCategoryViewableInUserCountry(show, CountryCode)) // return RedirectToAction("Index", "Home"); // if (!isEmailAllowed) // { // string CountryCodeBasedOnIpAddress = CountryCodeTemp; // if (!ContextHelper.IsCategoryViewableInUserCountry(show, CountryCodeBasedOnIpAddress)) // return RedirectToAction("Index", "Home"); // } // using (profiler.Step("Social Love")) // { // ViewBag.Loved = ContextHelper.HasSocialEngagement(user.UserId, GlobalConfig.SOCIAL_LOVE, id, EngagementContentType.Show); // } // using (profiler.Step("Social Rating")) // { // ViewBag.Rated = ContextHelper.HasSocialEngagement(user.UserId, GlobalConfig.SOCIAL_RATING, id, EngagementContentType.Show); // } // using (profiler.Step("Check for Active Entitlements")) //check for active entitlements based on categoryId // { // ViewBag.HasActiveSubscriptionBasedOnCategoryId = ContextHelper.HasActiveSubscriptionBasedOnCategoryId(user, show.CategoryId, registDt); // } // } // } // else // { // if (!ContextHelper.IsCategoryViewableInUserCountry(show, CountryCode)) // return RedirectToAction("Index", "Home"); // } // //Get Episode Count // using (profiler.Step("Episode Count")) // { // ViewBag.EpisodeCount = context.EpisodeCategories1.Count(e => e.Episode.OnlineStatusId == GlobalConfig.Visible && e.Show.CategoryId == show.CategoryId && e.Episode.OnlineStartDate < registDt && e.Episode.OnlineEndDate > registDt); // } // using (profiler.Step("Check Show Type")) // { // if (show is Movie) // { // ViewBag.CategoryType = "Movie"; // return RedirectToAction("Details", "Episode", new { id = GetMovieEpisodeId(show.CategoryId) }); // } // else if (show is SpecialShow) // { // ViewBag.CategoryType = "Special"; // return RedirectToAction("Details", "Episode", new { id = GetMovieEpisodeId(show.CategoryId) }); // } // else if (show is LiveEvent) // { // ViewBag.CategoryType = "LiveEvent"; // var episodeCategory = context.EpisodeCategories1.FirstOrDefault(e => e.CategoryId == show.CategoryId); // if (episodeCategory != null) // return RedirectToAction("Details", "Live", new { id = episodeCategory.EpisodeId, slug = MyUtility.GetSlug(episodeCategory.Episode.EpisodeName) }); // } // } // ViewBag.dbSlug = dbSlug; // ViewBag.IsAjaxCrawlable = Request.IsAjaxCrawlingCapable(); // Check if page is Ajax Crawlable // return View(show); // } // } // } // } // } // } // catch (Exception e) { MyUtility.LogException(e); } // return RedirectToAction("Index", "Home"); //} public PartialViewResult GetCastMembers(Show show) { try { var celebrities = show.CelebrityRoles.Where(cr => cr.Celebrity.StatusId == GlobalConfig.Visible).Select(c => c.Celebrity); if (celebrities != null) { var names = celebrities.Select(c => c.FullName); return PartialView("_GetCastMembers", string.Join(", ", names)); } } catch (Exception) { } return PartialView("_GetCastMembers", String.Empty); }
public static bool IsCategoryViewableInUserCountry(Show show, string CountryCode) { if (IsCategoryBlockedInCountry(show, CountryCode)) return false; else return IsCategoryAllowedInCountry(show, CountryCode); }
public static bool IsCategoryBlockedInCountry(Show show, string CountryCode) { var countryCodes = show.OnlineBlockedCountries.Where(o => o.StatusId == GlobalConfig.Visible).Select(o => o.CountryCode); if (countryCodes.Count() > 0) { if (countryCodes.Contains("--")) return true; else return countryCodes.Contains(CountryCode); } return false; }
public static bool IsCategoryViewableInUserCountry(Show show) { if (IsCategoryBlockedInCountry(show)) return false; else { return IsCategoryAllowedInCountry(show); //if (IsCategoryAllowedInCountry(show)) // return true; //else // return false; } }
public static bool IsCategoryBlockedInCountry(Show show) { var countryCodes = show.OnlineBlockedCountries.Where(o => o.StatusId == GlobalConfig.Visible).Select(o => o.CountryCode); if (countryCodes.Count() > 0) { if (countryCodes.Contains("--")) return true; else return countryCodes.Contains(MyUtility.GetCurrentCountryCodeOrDefault()); } return false; }
public static StreamSenseObj CreateStreamSenseObject(Episode episode, Show show) { string show_name = show.Description.Trim(); var streamSenseObj = new StreamSenseObj() { dateaired = episode.DateAired, id = episode.EpisodeId, playlist = String.Format("{0} episodes", show_name), program = show_name, IsEpisode = (show is IPTV2_Model.Movie || show is IPTV2_Model.LiveEvent) ? false : true }; if (show is IPTV2_Model.Movie) { streamSenseObj.playlist = String.Format("{0} movie", show_name); } else if (show is IPTV2_Model.LiveEvent) { streamSenseObj.playlist = String.Format("{0} live event", show_name); } return streamSenseObj; }