protected void btnDelete_OnClick(object sender, EventArgs e) { string streamID = lblID.Text.Trim(); LiveBroadcastRepository liveBroadcastRepository = new LiveBroadcastRepository(); LiveBroadcast lb = liveBroadcastRepository.Get(streamID); if (lb != null) { try { liveBroadcastRepository.Delete(ParseStream()); } catch (Exception ex) { displayError(ex.Message); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Get the stream ID and attempt to load it if (!string.IsNullOrEmpty(Request.QueryString["i"])) { string streamID = Request.QueryString["i"].ToString(); LiveBroadcastRepository liveBroadcastRepository = new LiveBroadcastRepository(); LiveBroadcast lb = liveBroadcastRepository.Get(streamID); if (lb != null) { DisplayStream(lb); } else { displayError("A stream with that ID was not found."); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["i"])) { // Sanitize the video ID string requestedID = Sanitizers.SanitizeQueryStringID(Request.QueryString["i"]); // See if this video exists LiveBroadcastRepository liveBroadcastRepository = new LiveBroadcastRepository(); LiveBroadcast liveStream = liveBroadcastRepository.Get(requestedID); if (liveStream != null) { // Determine if the viewer is viewing from inside the network string clientIP = Request.ServerVariables["REMOTE_ADDR"]; bool canUserAccessPrivateContent = Config.CanAccessPrivate(clientIP); // Set the page title string originalTitle = Page.Header.Title; Page.Header.Title = liveStream.Name + " - " + originalTitle; if (liveStream.IsEnded && !liveStream.ForcedLive) { displayError("This live stream has ended."); } else { if ( ((liveStream.IsPrivate) && (canUserAccessPrivateContent)) || (!liveStream.IsPrivate)) { tblContainer.Visible = true; if (liveStream.EmbedInsteadOfLink) { litPlayer.Text = YoutubeLiveBroadcastPlayer.GetHTML(liveStream); } else { if (!string.IsNullOrEmpty(liveStream.YouTubeID)) { Response.Redirect(@"https://www.youtube.com/watch?v=" + liveStream.YouTubeID); } else { displayError("Live stream has no Youtube ID set"); } } litStreamInfo.Text = streamInfoBox(liveStream); } else { displayError("This live stream is marked as private. You can only watch from within the LSKYSD network."); } } } else { displayError("A live stream with that ID does not exist."); } } else { displayError("Stream ID not specified."); } }