public static TVProgramme TVProgramme(this RPRecording rpr) { if (rpr.RequestType != RPRequestTypes.Manual) { return(mcData.GetTVProgramme(rpr.TVProgrammeID.ToString())); } // Manual recording is a special case TVProgramme tvp = new TVProgramme(); tvp.Title = rpr.Title; tvp.ServiceID = rpr.ManualRecordingServiceID.ToString(); tvp.StartTime = rpr.ManualRecordingStartTime.Ticks; tvp.StopTime = tvp.StartTime + (TimeSpan.FromSeconds(rpr.ManualRecordingDuration).Ticks); tvp.Id = "-10"; return(tvp); } // Recording => TV Programme
} // Request => Recordings (from which you can get the tv progs) public static RPRequest Request(this RPRecording rpr) // Recording => Request (linked by ID) { return(mcData.GetRPRequestWithID(rpr.RPRequestID)); }
// Extension methods as helpers, e.g. bools public static bool IsRecurring(this RPRecording rec) { return((rec.RequestType == RPRequestTypes.Series) || (rec.RequestType == RPRequestTypes.Keyword)); }