Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No commit message

  • Loading branch information...
commit 58d1bd3e768172ff1bb6a87821bbb03c1659c6e2 1 parent 8900ac3
yamp authored
View
172 TvEngine3/MPWebGuide/MPGuide/Default.aspx.cs
@@ -1,172 +0,0 @@
-using System;
-using System.Configuration;
-using System.Collections;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvLibrary;
-using TvDatabase;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using Gentle.Common;
-using Gentle.Framework;
-
-public partial class _Default : System.Web.UI.Page
-{
- IList _recordings;
- protected void Page_Load(object sender, EventArgs e)
- {
- try
- {
- _recordings = Recording.ListAll();
- }
- catch (Exception)
- {
- Response.Redirect("install/default.aspx");
- return;
- }
- labelDate.Text = DateTime.Now.ToLongDateString();
- labelTime.Text = DateTime.Now.ToShortTimeString();
- UpdateRecentRecordings();
- UpdateSchedule();
- }
- void UpdateRecentRecordings()
- {
- SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Recording));
- sb.AddOrderByField(false, "startTime");
- SqlStatement stmt = sb.GetStatement(true);
- IList _recordings = ObjectFactory.GetCollection(typeof(Recording), stmt.Execute());
-
- int count = 0;
- foreach (Recording rec in _recordings)
- {
- AddRecording(rec);
- count++;
- if (count > 5) break;
- }
- if (_recordings.Count>6)
- AddRow(tableRecordings,DateTime.MinValue, DateTime.MinValue, "", "More...", -1, "recordings");
-
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "recording_list_bottom");
- row.Cells.Add(cell);
- tableRecordings.Rows.Add(row);
- }
-
- void AddRecording(Recording rec)
- {
- AddRow(tableRecordings,rec.StartTime, rec.EndTime, rec.ReferencedChannel().Name, rec.Title, rec.IdRecording, "recordings");
- }
- void UpdateSchedule()
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- IList schedules = Schedule.ListAll();
- List<Schedule> allSchedules = new List<Schedule>();
- foreach (Schedule rec in schedules)
- {
- List<Schedule> series = layer.GetRecordingTimes(rec, 14);
- for (int i = 0; i < series.Count; i++)
- {
- allSchedules.Add(series[i]);
- }
- }
-
- allSchedules.Sort(new SortScheduleOnDateTime(true));
- int count = 0;
- foreach (Schedule rec in allSchedules)
- {
- AddSchedule(rec);
- count++;
- if (count > 5) break;
- }
- if (schedules.Count>6)
- AddRow(tableSchedules, DateTime.MinValue, DateTime.MinValue, "", "More...", -1, "schedules");
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "recording_list_bottom");
- row.Cells.Add(cell);
- tableSchedules.Rows.Add(row);
-
- }
-
- void AddSchedule(Schedule rec)
- {
- AddRow(tableSchedules, rec.StartTime, rec.EndTime, rec.ReferencedChannel().Name, rec.ProgramName, rec.IdSchedule, "schedules");
- }
- void AddRow(HtmlTable table, DateTime startTime, DateTime endTime, string channelName, string programName, int id, string url)
- {
- HtmlTableRow baseRow = new HtmlTableRow();
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.Attributes.Add("class", "recording_list_middle");
-
- HtmlTable subTable = new HtmlTable();
- subTable.Attributes.Add("class", "grid_default");
- subTable.CellPadding = 0;
- subTable.CellSpacing = 0;
- subTable.Style.Add("border-right", "#ffffff 1px solid");
- subTable.Style.Add("padding-right", "3px");
- subTable.Style.Add("border-top", "#ffffff 1px solid");
- subTable.Style.Add("padding-left", "3px");
- subTable.Style.Add("margin-bottom", "0px");
- subTable.Style.Add("border-left", "#ffffff 1px solid");
- subTable.Style.Add("width", "100%");
- subTable.Style.Add("padding-top", "2px");
- subTable.Style.Add("border-bottom", "blue 0px solid");
-
- HtmlTableRow subRow = new HtmlTableRow();
- subRow.VAlign = "top";
- HtmlTableCell td1 = new HtmlTableCell();
- HtmlTableCell td2 = new HtmlTableCell();
- HtmlTableCell td3 = new HtmlTableCell();
- td1.Attributes.Add("class", "recording_list_text");
- td1.Style.Add("padding-right", "4px");
- td1.Style.Add("padding-left", "4px");
- td1.Style.Add("padding-bottom", "4px");
- td1.Style.Add("width", "100%");
- td1.Style.Add("padding-top", "4px");
- td1.Style.Add("border-bottom", "#304a66 1px solid");
- if (startTime != DateTime.MinValue)
- {
- string title = String.Format("{0} {1}-{2} ({3})", startTime.ToString("ddd d MMM"), startTime.ToString("HH:mm"), endTime.ToString("HH:mm"), channelName);
- td1.InnerHtml = String.Format("<a class=\"recording_list_text\" href=\"{3}.aspx?id={1}\" title=\"{2}\">{0}</a>&nbsp;&nbsp;", programName, id, title, url);
- }
- else
- {
- td1.InnerHtml = String.Format("<a class=\"recording_list_text\" href=\"{1}.aspx\">{0}</a>&nbsp;&nbsp;", programName,url);
- }
- td2.Style.Add("border-bottom", "#304a66 1px solid");
- td2.InnerHtml = "&nbsp;&nbsp;";
- td3.Attributes.Add("class", "recording_list_text");
- td3.Style.Add("padding-right", "4px");
- td3.Style.Add("padding-left", "4px");
- td3.Style.Add("padding-bottom", "4px");
- td3.Style.Add("width", "100%");
- td3.Style.Add("padding-top", "4px");
- td3.Style.Add("border-bottom", "#304a66 1px solid");
- if (startTime != DateTime.MinValue)
- {
- if (startTime.Date == DateTime.Now.Date)
- td3.InnerHtml = String.Format("<nobr>{0}</nobr>", startTime.ToString("HH:mm"));
- else
- td3.InnerHtml = String.Format("<nobr>{0}</nobr>", startTime.ToString("ddd d MMM"));
- }
- else
- {
- td3.InnerHtml = "";
- }
-
-
- subRow.Cells.Add(td1);
- subRow.Cells.Add(td2);
- subRow.Cells.Add(td3);
- subTable.Rows.Add(subRow);
- cellBase.Controls.Add(subTable);
- baseRow.Cells.Add(cellBase);
- table.Rows.Add(baseRow);
- }
-}
View
33 TvEngine3/MPWebGuide/MPGuide/LogonPage.aspx.cs
@@ -1,33 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-
-public partial class LogonPage : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- textBoxLogin.Focus();
- }
- }
- protected void buttonSignIn_Click(object sender, EventArgs e)
- {
- if (FormsAuthentication.Authenticate(textBoxLogin.Text,textBox1.Text))
- {
- FormsAuthentication.RedirectFromLoginPage(textBoxLogin.Text,true);
- }
- else
- {
- textBox1.Text = "";
-
- }
- }
-}
View
205 TvEngine3/MPWebGuide/MPGuide/ServerStatus.aspx.cs
@@ -1,205 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvLibrary;
-using TvControl;
-using TvDatabase;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using TvLibrary.Streaming;
-using Gentle.Common;
-using Gentle.Framework;
-
-public partial class ServerStatus : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- UpdateStatusBox();
- UpdateClientsBox();
- }
-
- void UpdateStatusBox()
- {
- ConnectToTvServer();
- TvServer server = new TvServer();
- IList cards = Card.ListAll();
- int cardNo = 0;
- string[] items = new string[10];
- foreach (Card card in cards)
- {
- cardNo++;
- AddCardRows(cardNo, card);
- }
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "recording_list_bottom");
- row.Cells.Add(cell);
- tableStatus.Rows.Add(row);
- }
-
-
- void AddCardRows(int cardNo, Card card)
- {
- HtmlTableRow baseRow = new HtmlTableRow();
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.Attributes.Add("class", "recording_list_middle");
-
- HtmlTable subTable = new HtmlTable();
- subTable.Attributes.Add("class", "grid_default");
- subTable.CellPadding = 0;
- subTable.CellSpacing = 0;
- subTable.Style.Add("border-right", "#ffffff 1px solid");
- subTable.Style.Add("padding-right", "3px");
- subTable.Style.Add("border-top", "#ffffff 1px solid");
- subTable.Style.Add("padding-left", "3px");
- subTable.Style.Add("margin-bottom", "0px");
- subTable.Style.Add("border-left", "#ffffff 1px solid");
- subTable.Style.Add("width", "100%");
- subTable.Style.Add("padding-top", "2px");
- subTable.Style.Add("border-bottom", "blue 0px solid");
-
- HtmlTableRow subRow = new HtmlTableRow();
- subRow.VAlign = "top";
- HtmlTableCell td1 = new HtmlTableCell();
- td1.Attributes.Add("class", "recording_list_text");
- td1.Style.Add("padding-right", "4px");
- td1.Style.Add("padding-left", "4px");
- td1.Style.Add("padding-bottom", "4px");
- td1.Style.Add("width", "100%");
- td1.Style.Add("padding-top", "4px");
- td1.Style.Add("border-bottom", "#304a66 1px solid");
- td1.Align = "left";
-
-
- td1.InnerHtml = string.Format("<span class=\"recording_list_text\"><table width=\"100%\"><tr><td>State</td><td>Channel</td><td>Scrambled</td><td>User</td><td>Card</td></tr>");
-
- if (card.Enabled == false)
- {
- td1.InnerHtml += String.Format("<tr><td>disabled</td><td>-</td><td>-</td><td>-</td><td>{0}</td></tr>", card.Name);
- }
- else
- {
- User[] users = RemoteControl.Instance.GetUsersForCard(card.IdCard);
- if (users.Length == 0)
- {
- User user = new User();
- user.CardId = card.IdCard;
- VirtualCard vcard = new VirtualCard(user);
- string tmp = "idle";
- if (vcard.IsScanning) tmp = "Scanning";
- if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
- td1.InnerHtml += string.Format("<tr><td>{0}</td><td>-</td><td>-</td><td>-</td><td>{1}</td></tr>", tmp, card.Name);
- }
- else
- {
- for (int i = 0; i < users.Length; ++i)
- {
- VirtualCard vcard = new VirtualCard(users[i]);
- string tmp = "idle";
- if (vcard.IsTimeShifting) tmp = "Timeshifting";
- if (vcard.IsRecording) tmp = "Recording";
- if (vcard.IsScanning) tmp = "Scanning";
- if (vcard.IsGrabbingEpg) tmp = "Grabbing EPG";
-
- string scrambled = "idle";
- if (vcard.IsScrambled) scrambled = "yes";
- else scrambled = "no";
- td1.InnerHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>", tmp, vcard.ChannelName, scrambled, users[i].Name, card.Name);
- }
- }
- }
- td1.InnerHtml += "</table><span>";
- //<tr><td>state</td><td>Channel</td><td>Channel</td><td>Scrambled</td><td>User</td></tr>
-
- subRow.Cells.Add(td1);
- subTable.Rows.Add(subRow);
- cellBase.Controls.Add(subTable);
- baseRow.Cells.Add(cellBase);
- tableStatus.Rows.Add(baseRow);
- }
- void UpdateClientsBox()
- {
-
- ConnectToTvServer();
- List<RtspClient> clients = RemoteControl.Instance.StreamingClients;
-
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "recording_list_bottom");
- row.Cells.Add(cell);
- tableClients.Rows.Add(row);
- }
-
-
- void AddClientRows(List<RtspClient> clients)
- {
- HtmlTableRow baseRow = new HtmlTableRow();
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.Attributes.Add("class", "recording_list_middle");
-
- HtmlTable subTable = new HtmlTable();
- subTable.Attributes.Add("class", "grid_default");
- subTable.CellPadding = 0;
- subTable.CellSpacing = 0;
- subTable.Style.Add("border-right", "#ffffff 1px solid");
- subTable.Style.Add("padding-right", "3px");
- subTable.Style.Add("border-top", "#ffffff 1px solid");
- subTable.Style.Add("padding-left", "3px");
- subTable.Style.Add("margin-bottom", "0px");
- subTable.Style.Add("border-left", "#ffffff 1px solid");
- subTable.Style.Add("width", "100%");
- subTable.Style.Add("padding-top", "2px");
- subTable.Style.Add("border-bottom", "blue 0px solid");
-
- HtmlTableRow subRow = new HtmlTableRow();
- subRow.VAlign = "top";
- HtmlTableCell td1 = new HtmlTableCell();
- td1.Attributes.Add("class", "recording_list_text");
- td1.Style.Add("padding-right", "4px");
- td1.Style.Add("padding-left", "4px");
- td1.Style.Add("padding-bottom", "4px");
- td1.Style.Add("width", "100%");
- td1.Style.Add("padding-top", "4px");
- td1.Style.Add("border-bottom", "#304a66 1px solid");
- td1.Align = "left";
-
-
- td1.InnerHtml = string.Format("<span class=\"recording_list_text\"><table width=\"100%\"><tr><td>Stream</td><td>IP</td><td>Active</td><td>Started</td><td>Description</td></tr>");
-
- for (int i = 0; i < clients.Count; ++i)
- {
- string tmp = "no";
- if (clients[i].IsActive) tmp = "yes";
- td1.InnerHtml += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>",
- clients[i].StreamName, clients[i].IpAdress, tmp, clients[i].DateTimeStarted.ToString("yyyy-MM-dd HH:mm:ss"), clients[i].Description);
- }
- td1.InnerHtml += "</table><span>";
- //<tr><td>state</td><td>Channel</td><td>Channel</td><td>Scrambled</td><td>User</td></tr>
-
- subRow.Cells.Add(td1);
- subTable.Rows.Add(subRow);
- cellBase.Controls.Add(subTable);
- baseRow.Cells.Add(cellBase);
- tableClients.Rows.Add(baseRow);
- }
- void ConnectToTvServer()
- {
- IList servers = TvDatabase.Server.ListAll();
- foreach (TvDatabase.Server server in servers)
- {
- if (!server.IsMaster) continue;
- RemoteControl.Clear();
- RemoteControl.HostName = server.HostName;
- return;
-
- }
- }
-}
View
18 TvEngine3/MPWebGuide/MPGuide/ShowChannel.aspx.cs
@@ -1,18 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-
-public partial class ShowChannel : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
-
- }
-}
View
685 TvEngine3/MPWebGuide/MPGuide/TvGuide.aspx.cs
@@ -1,685 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvDatabase;
-using TvLibrary;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using Gentle.Common;
-using Gentle.Framework;
-using TvControl;
-public partial class TvGuide : System.Web.UI.Page
-{
- const int PIX_PER_MINUTE = 5;
- const int OFFSET_Y = 60;
- const int OFFSET_X = 200;
- const int ROW_HEIGHT = 26;
-
- IList _schedules;
- protected void Page_Load(object sender, EventArgs e)
- {
- hidCurrentFileId.ValueChanged += new EventHandler(hidCurrentFileId_ValueChanged);
- if (!Page.IsPostBack)
- {
- UpdateGuide();
- FillCombo();
- }
- }
-
- void hidCurrentFileId_ValueChanged(object sender, EventArgs e)
- {
- UpdateGuide();
- }
-
-
- void UpdateGuide()
- {
-
- try
- {
- _schedules = Schedule.ListAll();
- }
- catch (Exception)
- {
- Response.Redirect("install/default.aspx");
- return;
- }
- ChannelGroup group;
- List<Channel> tvChannels = new List<Channel>();
- if (Session["idGroup"] != null)
- {
- int id = (int)Session["idGroup"];
- group = ChannelGroup.Retrieve(id);
- }
- else
- {
- group = (ChannelGroup)ChannelGroup.ListAll()[0];
- Session["idGroup"] = group.IdGroup;
- }
- foreach (GroupMap groupMap in group.ReferringGroupMap())
- {
- Channel ch = groupMap.ReferencedChannel();
- if (ch.IsTv)
- {
- tvChannels.Add(ch);
- }
- }
-
- UpdateGuide(tvChannels);
- }
-
- void FillCombo()
- {
- ChannelGroup group;
- if (Session["idGroup"] != null)
- {
- int id = (int)Session["idGroup"];
- group = ChannelGroup.Retrieve(id);
- }
- else
- {
- group = (ChannelGroup)ChannelGroup.ListAll()[0];
- Session["idGroup"] = group.IdGroup;
- }
-
- IList groups = ChannelGroup.ListAll();
- int selected = 0;
- foreach (ChannelGroup group2 in groups)
- {
- DropDownListGroup.Items.Add(group2.GroupName);
- if (group2.GroupName == group.GroupName) selected = DropDownListGroup.Items.Count - 1;
- }
- DropDownListGroup.SelectedIndex = selected;
-
- DateTime now;
- if (Session["currentTime"] == null)
- {
- now = DateTime.Now;
- Session["currentTime"] = now;
- }
- now = (DateTime)Session["currentTime"];
-
- int min = now.Minute;
- if (min < 30) min = 0;
- else min = 30;
- now = now.AddMinutes(-now.Minute + min);
- now = now.AddSeconds(-now.Second);
- now = now.AddMilliseconds(-now.Millisecond);
-
-
-
- DateTime dt = new DateTime(2000, 1, 1, 0, 0, 0);
- DateTime dtEnd = dt.AddDays(1);
- while (dt < dtEnd)
- {
- dropDownTime.Items.Add(dt.ToShortTimeString());
- if (dt.Hour == now.Hour && dt.Minute == now.Minute) dropDownTime.SelectedIndex = dropDownTime.Items.Count - 1;
- dt = dt.AddMinutes(30);
- }
- DateTime dateNow = DateTime.Now;
- DateTime dateEnd = now.AddDays(14);
- while (dateNow < dateEnd)
- {
- dropDownDate.Items.Add(dateNow.ToLongDateString());
- if (dt.Date == now.Date) dropDownDate.SelectedIndex = dropDownDate.Items.Count - 1;
- dateNow = dateNow.AddDays(1);
- }
- }
- void UpdateGuide(List<Channel> tvChannels)
- {
- DateTime now;
- if (Session["currentTime"] == null)
- {
- now = DateTime.Now;
- Session["currentTime"] = now;
- }
- now = (DateTime)Session["currentTime"];
-
- int min = now.Minute;
- if (min < 30) min = 0;
- else min = 30;
- now = now.AddMinutes(-now.Minute + min);
- now = now.AddSeconds(-now.Second);
- now = now.AddMilliseconds(-now.Millisecond);
-
-
-
- spanClock.InnerText = DateTime.Now.ToShortTimeString();
- TvBusinessLayer layer = new TvBusinessLayer();
-
-
- DateTime end = now.AddHours(2);
- Dictionary<int, List<Program>> programs = layer.GetProgramsForAllChannels(now, end, tvChannels);
-
- List<Program> headers = new List<Program>();
- Channel ch = new Channel(now.ToShortDateString(), false, true, 0, DateTime.MinValue, false, DateTime.MinValue, 0, false, "", false);
- headers.Add(new Program(1, now.AddMinutes(0), now.AddMinutes(30), now.ToShortTimeString(), "", "", false));
- headers.Add(new Program(1, now.AddMinutes(30), now.AddMinutes(60), now.AddMinutes(30).ToShortTimeString(), "", "", false));
- headers.Add(new Program(1, now.AddMinutes(60), now.AddMinutes(90), now.AddMinutes(60).ToShortTimeString(), "", "", false));
- headers.Add(new Program(1, now.AddMinutes(90), now.AddMinutes(120), now.AddMinutes(90).ToShortTimeString(), "", "", false));
- ShowGuideForChannel(0, now, end, ch, headers);
- int count = 0;
- foreach (Channel channel in tvChannels)
- {
- if (programs.ContainsKey(channel.IdChannel))
- {
- ShowGuideForChannel(count + 1, now, end, channel, programs[channel.IdChannel]);
- count++;
- }
- //if (count > 15) break;
- }
- }
-
- void ShowGuideForChannel(int nr, DateTime startTime, DateTime endTime, Channel channel, List<Program> programs)
- {
- HtmlTableRow row = new HtmlTableRow();
- AddChannelRow(nr, startTime, endTime, channel, row, programs);
- guideTable.Rows.Add(row);
- }
- void AddChannelRow(int nr, DateTime now, DateTime end, Channel channel, HtmlTableRow row, List<Program> programs)
- {
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.ColSpan = 1;
- int posy = OFFSET_Y + nr * ROW_HEIGHT;
- cellBase.Attributes.Add("class", "gc");
- if (nr == 0)
- {
- cellBase.InnerHtml = String.Format("<nobr><span class=\"guide_title_text\">{0}</span></nobr>", channel.Name);
- }
- else
- {
- cellBase.InnerHtml = String.Format("<span class=\"gcn\">{0}</span>", nr);
- cellBase.InnerHtml += String.Format("<nobr><A class=gca href=\"ShowChannel.aspx?id={0}\">{1}</A></nobr>", channel.IdChannel, channel.Name);
- }
- row.Cells.Add(cellBase);
-#if NOTDEF
- int posy = OFFSET_Y + nr * ROW_HEIGHT;
- HtmlGenericControl cellBase = new HtmlGenericControl();
- cellBase.Style.Add("background-color", "#0d4798");
- cellBase.Style.Add("position", "absolute");
- cellBase.Style.Add("left", "25px");
- cellBase.Style.Add("height", "25px");
- cellBase.Style.Add("width", "175px");
- cellBase.Style.Add("top", String.Format("{0}px", posy));
-
- HtmlGenericControl subTable = new HtmlGenericControl();
- if (nr == 0)
- {
- subTable.InnerHtml = String.Format("<nobr><span class=\"guide_title_text\">{0}</span></nobr>", channel.Name);
- }
- else
- {
- subTable.InnerHtml = String.Format("<span class=\"grid_channel_num\" style=\"cursor: pointer\">{0}</span>", nr);
- subTable.InnerHtml += String.Format("<nobr><A class=grid_channel style=\"CURSOR: pointer\" href=\"ShowChannel.aspx?id={0}\">{1}</A></nobr>", channel.IdChannel, channel.Name);
- }
-
- cellBase.Controls.Add(subTable);
- divGuide.Controls.Add(cellBase);
-#endif
- if (programs.Count == 0)
- {
- Program p = new Program(channel.IdChannel, now, end, "No epg available", "", "", false);
- programs.Add(p);
- }
- Program last = programs[programs.Count - 1];
- if (last.EndTime < end)
- {
- Program p = new Program(channel.IdChannel, last.EndTime, end, "No epg available", "", "", false);
- programs.Add(p);
- }
- AddPrograms(nr, now, end, row, programs);
- }
-
- void AddPrograms(int nr, DateTime now, DateTime end, HtmlTableRow row, List<Program> programs)
- {
- int spanPos = 0;
- int cellCount = 0;
- bool addRightContinue = false;
- string className="";
- foreach (Program program in programs)
- {
- DateTime startTime = program.StartTime;
- if (startTime < now) startTime = now;
- DateTime endTime = program.EndTime;
- if (endTime > end) endTime = end;
- int min = startTime.Minute % 10;
- if (min > 0 && min < 5) startTime = startTime.AddMinutes(-min);
- else if (min > 5) startTime = startTime.AddMinutes((10 - min));
- min = endTime.Minute % 10;
- if (min > 0 && min < 5) endTime = endTime.AddMinutes(-min);
- else if (min > 5) endTime = endTime.AddMinutes((10 - min));
- TimeSpan ts = endTime - startTime;
- int span = (int)((ts.TotalMinutes+0.5) / 5);
- if (span <= 0) continue;
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.ColSpan = span;
- cellBase.InnerText = String.Format("{0} {1}",(spanPos),span);
- //cellBase.VAlign = "middle";
- spanPos += span;
- if (DateTime.Now >= program.StartTime && DateTime.Now <= program.EndTime && nr > 0)
- {
- cellBase.Attributes.Add("class", "gn");
- className = "gce";
- }
- else
- {
- cellBase.Attributes.Add("class", "gd");
- className = "gde";
- }
- cellBase.Attributes.Add("title", String.Format("{0} {1}-{2}\r\n{3}", program.Title, program.StartTime.ToShortTimeString(), program.EndTime.ToShortTimeString(), program.Description));
-
-
- string html = "";
- if (program.StartTime < now)
- {
- html += "<img class=\"imgm\" src=\"images/lc.gif\">";
-
- }
- else
- {
- html += "<img class=\"imgm\" src=\"images/lb.gif\">";
- }
- int length = span*3;
- if (length > program.Title.Length) length = program.Title.Length;
- string title = "";
- if (length > 3)
- {
- if (length != program.Title.Length)
- title = program.Title.Substring(0, length - 3) + "...";
- else
- title = program.Title.Substring(0, length);
- }
- if (nr == 0)
- {
- html += String.Format("<span class=guide_title_text>{0}</span>", title); ;
- }
- else
- {
- html += title; ;
- cellBase.Attributes.Add("onclick", String.Format("op({0})", program.IdProgram));
- }
- if (program.EndTime > end)
- {
- addRightContinue = true;
- }
- bool isSeries;
- if (IsRecording(program, out isSeries))
- {
- if (isSeries)
- {
- html += String.Format("<img align=\"middle\" src=\"images/icon_record_series.png\">"); ;
- }
- else
- {
- html += String.Format("<img align=\"middle\" src=\"images/icon_record_single.png\">");
- }
- //subRow.Controls.Add(tdRec);
-
- }
- cellCount++;
- cellBase.InnerHtml = html;
- row.Cells.Add(cellBase);
- }
- HtmlTableCell cellEnd = new HtmlTableCell();
- cellEnd.Attributes.Add("class", className);
- if (addRightContinue)
- {
- cellEnd.InnerHtml = "<img src=\"images/rc.gif\">";
- }
- row.Cells.Add(cellEnd);
-#if NOTDEF
- //695 = 120min = 24x5min
- //
- int cellCount = 0;
- foreach (Program program in programs)
- {
- DateTime startTime = program.StartTime;
- if (startTime < now) startTime = now;
- DateTime endTime = program.EndTime;
- if (endTime > end) endTime = end;
- HtmlGenericControl cellBase = new HtmlGenericControl();
- if (DateTime.Now >= program.StartTime && DateTime.Now <= program.EndTime && nr > 0)
- {
- cellBase.Attributes.Add("class", "grid_kids");
- }
- else
- {
- cellBase.Attributes.Add("class", "grid_default");
- }
- cellBase.Attributes.Add("title", String.Format("{0} {1}-{2}\r\n{3}", program.Title, program.StartTime.ToShortTimeString(), program.EndTime.ToShortTimeString(), program.Description));
-
- TimeSpan ts = endTime - startTime;
- int width = (int)(ts.TotalMinutes * 6.5);
- ts = startTime - now;
- int posx = OFFSET_X + (int)(ts.TotalMinutes * 6.5);
- int posy = OFFSET_Y + nr * ROW_HEIGHT;
- cellBase.Style.Add("position", "absolute");
- cellBase.Style.Add("left", String.Format("{0}px", posx));
- cellBase.Style.Add("top", String.Format("{0}px", posy));
- cellBase.Style.Add("height", "25px");
- cellBase.Style.Add("width", String.Format("{0}px", width));
- cellBase.Style.Add("vertical-align", "middle");
- //HtmlGenericControl subRow = new HtmlGenericControl();
- //subRow.Style.Add("vertical-align", "middle");
- //HtmlGenericControl td1 = new HtmlGenericControl();
- //HtmlGenericControl td2 = new HtmlGenericControl();
- string html = "";
- if (program.StartTime < now)
- {
- //td1.InnerHtml = String.Format("<img height=\"25\" src=\"images/leftcontinue.gif\" width=\"12\">");
- html += String.Format("<img align=\"middle\" height=\"25\" src=\"images/leftcontinue.gif\" width=\"12\">");
-
- }
- else
- {
- if (cellCount == 0)
- {
- //td1.InnerHtml = String.Format("<img height=\"25\" src=\"images/leftblock.gif\" width=\"12\">");
- html += String.Format("<img align=\"middle\" height=\"25\" src=\"images/leftblock.gif\" width=\"12\">");
-
- }
- else
- {
- //td1.InnerHtml = String.Format("<img height=\"25\" src=\"images/leftblock.gif\" width=\"2\">");
- html += String.Format("<img align=\"middle\" height=\"25\" src=\"images/leftblock.gif\" width=\"2\">");
-
- }
- }
- cellCount++;
- //td2.VAlign = "center";
- //td2.Width = "100%";
- int length = width / 8;
- if (length > program.Title.Length) length = program.Title.Length;
- string title = "";
- if (length > 3)
- {
- if (length != program.Title.Length)
- title = program.Title.Substring(0, length - 3) + "...";
- else
- title = program.Title.Substring(0, length);
- }
- //title = ".";
- if (nr == 0)
- {
- //td2.InnerHtml = String.Format("<A class=guide_title_text>{0}</A>", title);
- html += String.Format("<span class=guide_title_text>{0}</span>", title); ;
- }
- else
- {
- //td2.InnerHtml = String.Format("<nobr>&nbsp;<A class=white style=\"CURSOR: pointer\" href=\"showProgram.aspx?id={1}\">{0}</A></nobr>", title, program.IdProgram);
- html += String.Format("<span class=white style=\"CURSOR: pointer\" onclick=\"onProgramClicked({1})\"\">{0}</span>", title, program.IdProgram); ;
- }
- //subRow.Controls.Add(td1);
- //subRow.Controls.Add(td2);
- bool isSeries;
- if (IsRecording(program, out isSeries))
- {
- HtmlGenericControl tdRec = new HtmlGenericControl();
- if (isSeries)
- {
- //tdRec.InnerHtml = String.Format("<img align=\"right\" src=\"images/icon_record_series.png\">");
- html += String.Format("<img align=\"middle\" src=\"images/icon_record_series.png\">"); ;
- }
- else
- {
- //tdRec.InnerHtml = String.Format("<img align=\"right\" src=\"images/icon_record_single.png\">");
- html += String.Format("<img align=\"middle\" src=\"images/icon_record_single.png\">");
- }
- //subRow.Controls.Add(tdRec);
-
- }
- cellBase.InnerHtml = html;
- divGuide.Controls.Add(cellBase);
- if (program.EndTime > end)
- {
- HtmlGenericControl divCtl = new HtmlGenericControl();
-
- string style = String.Format("style=\"position:absolute;left:{0}px;top:{1}px;\"", posx + width, posy);
- //HtmlGenericControl td3 = new HtmlGenericControl();
- //td3.InnerHtml = "<img height=\"25\" src=\"images/rightcontinue.gif\" width=\"12\">";
- html = String.Format("<img {0} height=\"25\" src=\"images/rightcontinue.gif\" width=\"12\">", style);
- divCtl.InnerHtml = html;
- divGuide.Controls.Add(divCtl);
- }
- }
-#endif
- }
-
- #region event handlers
- protected void idForward_Click(object sender, EventArgs e)
- {
- DateTime now;
- if (Session["currentTime"] == null)
- {
- now = DateTime.Now;
- Session["currentTime"] = now;
- }
- now = (DateTime)Session["currentTime"];
- now = now.AddMinutes(30);
- Session["currentTime"] = now;
- UpdateGuide();
- }
- protected void idBack_Click(object sender, EventArgs e)
- {
- DateTime now;
- if (Session["currentTime"] == null)
- {
- now = DateTime.Now;
- Session["currentTime"] = now;
- }
- now = (DateTime)Session["currentTime"];
- now = now.AddMinutes(-30);
- Session["currentTime"] = now;
- UpdateGuide();
- }
- protected void dropDownTime_SelectedIndexChanged(object sender, EventArgs e)
- {
- DateTime now = (DateTime)Session["currentTime"];
- DateTime dateNow = DateTime.Now;
- dateNow = dateNow.AddDays(dropDownDate.SelectedIndex);
- now = new DateTime(dateNow.Year, dateNow.Month, dateNow.Day, now.Hour, now.Minute, 0);
- now = now.AddHours(-now.Hour);
- now = now.AddMinutes(-now.Minute);
- now = now.AddMinutes(dropDownTime.SelectedIndex * 30);
- Session["currentTime"] = now;
- UpdateGuide();
-
- }
- protected void dropDownDate_SelectedIndexChanged(object sender, EventArgs e)
- {
- DateTime now = (DateTime)Session["currentTime"];
- DateTime dateNow = DateTime.Now;
- dateNow = dateNow.AddDays(dropDownDate.SelectedIndex);
- now = new DateTime(dateNow.Year, dateNow.Month, dateNow.Day, now.Hour, now.Minute, 0);
- now = now.AddHours(-now.Hour);
- now = now.AddMinutes(-now.Minute);
- now = now.AddMinutes(dropDownTime.SelectedIndex * 30);
- Session["currentTime"] = now;
- UpdateGuide();
-
- }
- bool IsRecording(Program program, out bool isSeries)
- {
- isSeries = false;
- foreach (Schedule schedule in _schedules)
- {
- if (schedule.IsRecordingProgram(program, true))
- {
- if (schedule.ScheduleType != 0) isSeries = true;
- return true;
- }
- }
- return false;
- }
- /*
- protected void buttonDontRecord_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program prog = Program.Retrieve(Int32.Parse(idProgram.Value));
-
- foreach (Schedule schedule in _schedules)
- {
- if (schedule.IsRecordingProgram(prog, true))
- {
- if (schedule.ScheduleType == (int)ScheduleRecordingType.Once)
- {
- schedule.Delete();
- UpdateServer();
- break;
- }
- else
- {
- CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, prog.StartTime);
- canceledSchedule.Persist();
- UpdateServer();
- break;
- }
- }
- }
- UpdateGuide();
- }
-
- protected void buttonRecordOnce_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
-
- protected void buttonRecordDaily_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.Daily;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
- protected void buttonRecordWeekly_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.Weekly;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
- protected void buttonRecordMonFri_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.WorkingDays;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
- protected void buttonRecordEveryThis_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnThisChannel;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
- protected void buttonRecordEveryAll_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.EveryTimeOnEveryChannel;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
- protected void buttonRecordWeekends_Click(object sender, EventArgs e)
- {
- _schedules = Schedule.ListAll();
- Program program = Program.Retrieve(Int32.Parse(idProgram.Value));
- bool isSeries;
- if (IsRecording(program, out isSeries) == false)
- {
- TvBusinessLayer layer = new TvBusinessLayer();
- Schedule rec = new Schedule(program.IdChannel, program.Title, program.StartTime, program.EndTime);
- rec.ScheduleType = (int)ScheduleRecordingType.Weekends;
- rec.Persist();
- UpdateServer();
- }
- UpdateGuide();
- }
-
- void UpdateServer()
- {
- IList servers = TvDatabase.Server.ListAll();
- foreach (TvDatabase.Server server in servers)
- {
- if (!server.IsMaster) continue;
- RemoteControl.Clear();
- RemoteControl.HostName = server.HostName;
- RemoteControl.Instance.OnNewSchedule();
- return;
-
- }
- }*/
-
- protected void DropDownListGroup_SelectedIndexChanged(object sender, EventArgs e)
- {
- IList groups = ChannelGroup.ListAll();
- foreach (ChannelGroup group in groups)
- {
- if (group.GroupName == DropDownListGroup.SelectedItem.ToString())
- {
- Session["idGroup"] = group.IdGroup;
- UpdateGuide();
- return;
- }
- }
- Session["idGroup"] = ((ChannelGroup)groups[0]).IdGroup;
- UpdateGuide();
- }
- #endregion
-}
View
19 TvEngine3/MPWebGuide/MPGuide/logout.aspx.cs
@@ -1,19 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-
-public partial class logout : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- FormsAuthentication.SignOut();
- Response.Redirect("default.aspx");
- }
-}
View
170 TvEngine3/MPWebGuide/MPGuide/recordings.aspx.cs
@@ -1,170 +0,0 @@
-using System;
-using System.Configuration;
-using System.Collections;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvLibrary;
-using TvDatabase;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using Gentle.Common;
-using Gentle.Framework;
-
-public partial class recordings : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- radioTitle.Checked = true;
- UpdateRecordings();
- }
- }
-
- void UpdateRecordings()
- {
- SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Recording));
- if (radioTitle.Checked)
- sb.AddOrderByField(true, "title");
- else
- sb.AddOrderByField(true, "startTime");
-
- SqlStatement stmt = sb.GetStatement(true);
- IList recordings = ObjectFactory.GetCollection(typeof(Recording), stmt.Execute());
-
- int i = 0;
- while (i < recordings.Count)
- {
- List<Recording> recs = new List<Recording>();
- Recording rec = recordings[i] as Recording;
- recs.Add(rec);
- int x = i + 1;
- while (x < recordings.Count)
- {
- Recording rec2 = recordings[x] as Recording;
- if (rec.Title == rec2.Title)
- {
- x++;
- recs.Add(rec2);
- }
- else break;
- }
- AddRecording(recs);
- i = x;
- }
- }
-
- void AddRecording(List<Recording> recs)
- {
- int id=-1;
- if (Request["id"] != null)
- {
- id = Int32.Parse(Request["id"]);
- }
-
- if (id>0 && id!=recs[0].IdRecording) return;
- AddHeader(recs[0]);
- for (int i = 0; i < recs.Count; i++)
- {
- AddRow(recs[i], i == recs.Count - 1);
- }
- }
-
- void AddHeader(Recording rec)
- {
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "info_box_middle");
- cell.ColSpan = 2;
- cell.InnerHtml = String.Format("<div style=\"padding-right: 4px; padding-left: 4px; padding-bottom: 4px; width: 100%; padding-top: 4px\"><span class=\"info_box_title_text\">{0} </span></div>", rec.Title);
- row.Cells.Add(cell);
- tableList.Rows.Add(row);
- }
-
- void AddRow(Recording rec, bool last)
- {
- HtmlTableRow rowBase = new HtmlTableRow();
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.Attributes.Add("class", "info_box_middle");
-
-
- HtmlTable table = new HtmlTable();
- table.Attributes.Add("class", "grid_default");
- table.Style.Add("border-right", "#ffffff 1px solid");
- table.Style.Add("padding-right", "px");
- if (last)
- {
- table.Style.Add("border-top", "border-top: blue 0px solid");
- table.Style.Add("margin-bottom", "5px");
- table.Style.Add("padding-top", "0px");
- table.Style.Add("border-bottom", "#ffffff 1px solid");
- }
- else
- {
- table.Style.Add("border-top", "#ffffff 1px solid");
- table.Style.Add("margin-bottom", "0px");
- table.Style.Add("padding-top", "2px");
- table.Style.Add("border-bottom", "blue 0px solid");
- }
- table.Style.Add("padding-left", "3px");
- table.Style.Add("border-left", "#ffffff 1px solid");
- table.Style.Add("width", "100%");
- table.CellPadding = 0;
- table.CellSpacing = 0;
-
- HtmlTableRow row = new HtmlTableRow();
- row.Align = "top";
-
- HtmlTableCell td1 = new HtmlTableCell();
- HtmlTableCell td2 = new HtmlTableCell();
- HtmlTableCell td3 = new HtmlTableCell();
-
- td1.Attributes.Add("class", "recording_list_text");
- td1.Style.Add("padding-right", "4px");
- td1.Style.Add("padding-left", "4px");
- td1.Style.Add("padding-bottom", "4px");
- td1.Style.Add("padding-top", "4px");
- td1.Style.Add("width", "85%");
- td1.Style.Add("border-bottom", "#304a66 1px solid%");
- td1.InnerHtml = string.Format("<a class=\"recording_list_text\" href=\"javascript:loadInfo('recorded','1397')\">\"{0} - \"{1}</a>&nbsp;", rec.Title, rec.Description);
-
-
- td2.Style.Add("width", "40px");
- td2.Style.Add("border-bottom", "#304a66 1px solid");
- td2.InnerHtml = "&nbsp; &nbsp;";
-
-
- td3.Attributes.Add("class", "recording_list_text");
- td3.Style.Add("padding-right", "4px");
- td3.Style.Add("padding-left", "4px");
- td3.Style.Add("padding-bottom", "4px");
- td3.Style.Add("padding-top", "4px");
- td3.Style.Add("width", "50px");
- td3.Style.Add("border-bottom", "#304a66 1px solid%");
- td3.Align = "right";
- td3.InnerHtml = String.Format("<nobr>{0}</nobr>", rec.StartTime.ToString("ddd d MMM"));
- row.Cells.Add(td1);
- row.Cells.Add(td2);
- row.Cells.Add(td3);
- table.Rows.Add(row);
-
- cellBase.Controls.Add(table);
- rowBase.Cells.Add(cellBase);
- tableList.Rows.Add(rowBase);
- }
- protected void radioTitle_CheckedChanged(object sender, EventArgs e)
- {
- radioDate.Checked = false;
- UpdateRecordings();
- }
- protected void radioDate_CheckedChanged(object sender, EventArgs e)
- {
- radioTitle.Checked = false;
- UpdateRecordings();
- }
-}
View
200 TvEngine3/MPWebGuide/MPGuide/schedules.aspx.cs
@@ -1,200 +0,0 @@
-using System;
-using System.Configuration;
-using System.Collections;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvLibrary;
-using TvDatabase;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using Gentle.Common;
-using Gentle.Framework;
-
-public partial class schedules : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- radioTitle.Checked = true;
- UpdateSchedules();
- }
- }
-
- void UpdateSchedules()
- {
- SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Schedule));
- if (radioTitle.Checked)
- sb.AddOrderByField(true, "programName");
- else
- sb.AddOrderByField(true, "startTime");
- SqlStatement stmt = sb.GetStatement(true);
- IList schedules = ObjectFactory.GetCollection(typeof(Schedule), stmt.Execute());
- TvBusinessLayer layer = new TvBusinessLayer();
- foreach (Schedule schedule in schedules)
- {
- AddSchedule(layer, schedule);
- }
- }
-
- void AddSchedule(TvBusinessLayer layer, Schedule schedule)
- {
- int id = -1;
- if (Request["id"] != null)
- {
- id = Int32.Parse(Request["id"]);
- }
-
- if (id > 0 && id != schedule.IdSchedule) return;
- AddHeader(schedule);
- List<Schedule> series = layer.GetRecordingTimes(schedule, 14);
- for (int i = 0; i < series.Count; i++)
- {
- string title = schedule.ProgramName;
- IList programs = layer.GetPrograms(series[i].ReferencedChannel(), series[i].StartTime, series[i].EndTime);
- if (programs.Count > 0)
- {
- Program p = (Program)programs[0];
- if (p.Title == schedule.ProgramName)
- {
- AddRow(series[i], p, i == series.Count - 1);
- }
- }
- }
- if (series.Count == 0)
- {
- AddRow(schedule, null, true);
- }
- }
-
- void AddHeader(Schedule rec)
- {
- HtmlTableRow row = new HtmlTableRow();
- HtmlTableCell cell = new HtmlTableCell();
- cell.Attributes.Add("class", "info_box_middle");
- cell.ColSpan = 2;
- string title = "";
- switch ((ScheduleRecordingType)rec.ScheduleType)
- {
- case ScheduleRecordingType.Once:
- title = String.Format("{0}", rec.ProgramName);
- break;
- case ScheduleRecordingType.Daily:
- title = String.Format("{0} daily", rec.ProgramName);
- break;
- case ScheduleRecordingType.Weekly:
- title = String.Format("{0} weekly", rec.ProgramName);
- break;
- case ScheduleRecordingType.Weekends:
- title = String.Format("{0} weekends", rec.ProgramName);
- break;
- case ScheduleRecordingType.WorkingDays:
- title = String.Format("{0} mon-fri", rec.ProgramName);
- break;
- case ScheduleRecordingType.EveryTimeOnEveryChannel:
- title = String.Format("{0} every time", rec.ProgramName);
- break;
- case ScheduleRecordingType.EveryTimeOnThisChannel:
- title = String.Format("{0} every time on {1}", rec.ProgramName, rec.ReferencedChannel().Name);
- break;
- }
- cell.InnerHtml = String.Format("<div style=\"padding-right: 4px; padding-left: 4px; padding-bottom: 4px; width: 100%; padding-top: 4px\"><span class=\"info_box_title_text\">{0} </span></div>", title);
- row.Cells.Add(cell);
- tableList.Rows.Add(row);
- }
-
- void AddRow(Schedule rec, Program prog, bool last)
- {
- HtmlTableRow rowBase = new HtmlTableRow();
- HtmlTableCell cellBase = new HtmlTableCell();
- cellBase.Attributes.Add("class", "info_box_middle");
-
-
- HtmlTable table = new HtmlTable();
- table.Attributes.Add("class", "grid_default");
- table.Style.Add("border-right", "#ffffff 1px solid");
- table.Style.Add("padding-right", "px");
- if (last)
- {
- table.Style.Add("border-top", "border-top: blue 0px solid");
- table.Style.Add("margin-bottom", "5px");
- table.Style.Add("padding-top", "0px");
- table.Style.Add("border-bottom", "#ffffff 1px solid");
- }
- else
- {
- table.Style.Add("border-top", "#ffffff 1px solid");
- table.Style.Add("margin-bottom", "0px");
- table.Style.Add("padding-top", "2px");
- table.Style.Add("border-bottom", "blue 0px solid");
- }
- table.Style.Add("padding-left", "3px");
- table.Style.Add("border-left", "#ffffff 1px solid");
- table.Style.Add("width", "100%");
- table.CellPadding = 0;
- table.CellSpacing = 0;
-
- HtmlTableRow row = new HtmlTableRow();
- row.Align = "top";
-
- HtmlTableCell td1 = new HtmlTableCell();
- HtmlTableCell td2 = new HtmlTableCell();
- HtmlTableCell td3 = new HtmlTableCell();
-
- td1.Attributes.Add("class", "recording_list_text");
- td1.Style.Add("padding-right", "4px");
- td1.Style.Add("padding-left", "4px");
- td1.Style.Add("padding-bottom", "4px");
- td1.Style.Add("padding-top", "4px");
- td1.Style.Add("width", "85%");
- td1.Style.Add("border-bottom", "#304a66 1px solid%");
-
-
-
- if (prog == null)
- td1.InnerHtml = string.Format("<a class=\"recording_list_text\" href=\"javascript:loadInfo('recorded','1397')\">Nothing to record</a>&nbsp;");
- else
- td1.InnerHtml = string.Format("<a class=\"recording_list_text\" href=\"javascript:loadInfo('recorded','1397')\">\"{0} - \"{1}</a>&nbsp;", rec.ProgramName, prog.Description);
-
-
- td2.Style.Add("width", "40px");
- td2.Style.Add("border-bottom", "#304a66 1px solid");
- td2.InnerHtml = "&nbsp; &nbsp;";
-
-
- td3.Attributes.Add("class", "recording_list_text");
- td3.Style.Add("padding-right", "4px");
- td3.Style.Add("padding-left", "4px");
- td3.Style.Add("padding-bottom", "4px");
- td3.Style.Add("padding-top", "4px");
- td3.Style.Add("width", "50px");
- td3.Style.Add("border-bottom", "#304a66 1px solid%");
- td3.Align = "right";
- td3.InnerHtml = String.Format("<nobr>{0}</nobr>", rec.StartTime.ToString("ddd d MMM"));
- row.Cells.Add(td1);
- row.Cells.Add(td2);
- row.Cells.Add(td3);
- table.Rows.Add(row);
-
- cellBase.Controls.Add(table);
- rowBase.Cells.Add(cellBase);
- tableList.Rows.Add(rowBase);
- }
- protected void radioTitle_CheckedChanged(object sender, EventArgs e)
- {
- radioDate.Checked = false;
- UpdateSchedules();
-
- }
- protected void radioDate_CheckedChanged(object sender, EventArgs e)
- {
- radioTitle.Checked = false;
- UpdateSchedules();
-
- }
-}
View
18 TvEngine3/MPWebGuide/MPGuide/search.aspx.cs
@@ -1,18 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-
-public partial class search : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
-
- }
-}
View
35 TvEngine3/MPWebGuide/MPGuide/showProgram.aspx.cs
@@ -1,35 +0,0 @@
-using System;
-using System.Data;
-using System.Configuration;
-using System.Collections;
-using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
-using TvDatabase;
-using TvLibrary;
-using TvLibrary.Interfaces;
-using TvLibrary.Channels;
-using Gentle.Common;
-using Gentle.Framework;
-
-public partial class showProgram : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- ShowProgramInfo();
- }
- void ShowProgramInfo()
- {
- int id = Int32.Parse(Request.Params["id"]);
- Program program = Program.Retrieve(id);
- textBoxChannel.Text = program.ReferencedChannel().Name;
- textBoxTitle.Text = program.Title;
- textBoxDescription.Text = program.Description;
- textBoxGenre.Text = program.Genre;
- textBoxStart.Text = program.StartTime.ToShortTimeString();
- textEnd.Text = program.EndTime.ToShortTimeString() + " " + program.StartTime.ToLongDateString();
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.