// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class DVBProg : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Spludlow.WebControls.DisableOnClick(this.ButtonRecord); if (this.IsPostBack == false) { this._DisplayProg(); } } private void _DisplayProg() { DataRow[] rows = _ChannelAndProg(); this.GridViewChan.DataSource = Spludlow.Data.ADO.Swivel(rows[0]); this.GridViewChan.DataBind(); this.GridViewProg.DataSource = Spludlow.Data.ADO.Swivel(rows[1]); this.GridViewProg.DataBind(); } private DataRow[] _ChannelAndProg() { long programId = Int64.Parse(this.Request.QueryString["ProgramId"]); Spludlow.Video.VideoData videoData = new Spludlow.Video.VideoData(); DataRow progRow = videoData.Programmes.Rows.Find(programId); if (progRow == null) throw new ApplicationException("Programme row not found programId: " + programId); int channelId = (int)progRow["ChannelId"]; DataRow chanRow = videoData.Channels.Rows.Find(channelId); if (chanRow == null) throw new ApplicationException("Channel row not found channelId: " + channelId); return new DataRow[] { chanRow, progRow }; } protected void ButtonRecord_Click(object sender, EventArgs e) { DataRow[] rows = _ChannelAndProg(); Spludlow.Video.Recorder recorder = new Spludlow.Video.Recorder(true); recorder.SubmitRecording(rows[0], rows[1]); } }