public string GET_SiteMapAddress(string TargerGroupID) { Database db = new Database(); DataTable dt = new DataTable(); int nRet = -1; string SiteMapAddress = ""; /*連線DB*/ nRet = db.DBConnect(); if (nRet == 0) { string strParentGroupID = NUtility.trimBad(Session["ParentGroupID"].ToString()); string srtTargerGroupID = NUtility.trimBad(TargerGroupID); string SiteMap_SQL = @"DECLARE @Sitemap nvarchar(4000) SET @Sitemap = '' /*取得Sitmap*/ SELECT @Sitemap = @Sitemap + SecurityGroup.GroupName + '/' FROM dbo.UTILfn_Split( (SELECT GroupSearchKey + '/' + GroupID FROM dbo.fn_GetGroupTree(@ParentGroupID_1) WHERE GroupID = @TargerGroupID), '/') AS tblA INNER JOIN SecurityGroup ON tblA.[Value] = SecurityGroup.GroupID WHERE tblA.[Value] <> ( SELECT ParentGroupID FROM SecurityRelation WHERE AccountID =@ParentGroupID_2 ) SELECT @Sitemap AS Sitemap "; System.Data.SqlClient.SqlCommand SqlCom = new System.Data.SqlClient.SqlCommand(SiteMap_SQL, db.getOcnn()); SqlCom.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ParentGroupID_1", MDS.Utility.NUtility.trimBad(strParentGroupID))); SqlCom.Parameters.Add(new System.Data.SqlClient.SqlParameter("@TargerGroupID", MDS.Utility.NUtility.trimBad(srtTargerGroupID))); SqlCom.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ParentGroupID_2", MDS.Utility.NUtility.trimBad(strParentGroupID))); //呼叫傳入參數式sqlcmd的方法 nRet = db.ExecQuerySQLCommand(SqlCom, ref dt); if (nRet == 0) { if (dt.Rows.Count > 0) { SiteMapAddress = dt.Rows[0]["Sitemap"].ToString(); } } db.DBDisconnect(); } return(SiteMapAddress); }
public Recording(NUtility.ScheduledRecording BaseRecording, int UserOid) { this.BaseRecording = BaseRecording; this.Name = BaseRecording.Name; this.CaptureSourceOID = BaseRecording.CaptureSourceOID; this.ChannelName = BaseRecording.ChannelName; this.ChannelOID = BaseRecording.ChannelOID; this.EndTime = BaseRecording.EndTime; this.FailureReason = BaseRecording.FailureReason; this.Filename = BaseRecording.Filename; this.OID = BaseRecording.OID; this.PostPadding = BaseRecording.PostPadding; this.PrePadding = BaseRecording.PrePadding; this.StartTime = BaseRecording.StartTime; this.Status = BaseRecording.Status; this.EventOid = BaseRecording.EventOID; this.RecurrenceOid = BaseRecording.RecurrenceOID; NUtility.EPGEvent epgevent = Helpers.NpvrCoreHelper.EPGEventLoadByOID(BaseRecording.OID); var channel = Helpers.NpvrCoreHelper.ChannelLoadByOID(BaseRecording.ChannelOID); if (channel != null) { this.ChannelHasIcon = channel.Icon != null; this.ChannelNumber = channel.Number; } if (epgevent != null) { this.Subtitle = epgevent.Subtitle; this.Title = epgevent.Title; this.OriginalAirDate = epgevent.OriginalAirDate; this.Quality = epgevent.Quality; this.Rating = epgevent.Rating; this.Season = epgevent.Season; this.Episode = epgevent.Episode; this.Genres = epgevent.Genres; this.Description = epgevent.Description; this.Aspect = epgevent.Aspect; this.Audio = epgevent.Audio; this.StarRating = epgevent.StarRating; } }
public EpgListing(NUtility.EPGEvent EpgEvent) { this.Aspect = EpgEvent.Aspect; this.Audio = EpgEvent.Audio; this.ChannelOid = EpgEvent.ChannelOID; this.Description = EpgEvent.Description; this.EndTime = EpgEvent.EndTime; this.Episode = EpgEvent.Episode; this.FirstRun = EpgEvent.FirstRun; this.Genres = EpgEvent.Genres; this.Oid = EpgEvent.OID; this.OriginalAirDate = EpgEvent.OriginalAirDate; this.Rating = EpgEvent.Rating; this.Season = EpgEvent.Season; this.StarRating = EpgEvent.StarRating; this.StartTime = EpgEvent.StartTime; this.Subtitle = EpgEvent.Subtitle; this.Title = EpgEvent.Title; }
public RecurringRecording(NUtility.RecurringRecording BaseRecurringRecording) { this.AdvancedRules = BaseRecurringRecording.AdvancedRules; this.ChannelName = BaseRecurringRecording.ChannelName; this.ChannelOid = BaseRecurringRecording.ChannelOID; this.DayMask = BaseRecurringRecording.DayMask; this.EndTime = BaseRecurringRecording.EndTime; this.Keep = BaseRecurringRecording.Keep; this.MatchRules = BaseRecurringRecording.MatchRules; this.Name = BaseRecurringRecording.Name; this.Oid = BaseRecurringRecording.OID; this.OnlyNewEpisodes = BaseRecurringRecording.OnlyNewEpisodes; this.PostPadding = BaseRecurringRecording.PostPadding; this.PrePadding = BaseRecurringRecording.PrePadding; this.Quality = BaseRecurringRecording.Quality; this.RecordingDirectoryId = BaseRecurringRecording.RecordingDirectoryID; this.StartTime = BaseRecurringRecording.StartTime; this.Timeslot = BaseRecurringRecording.Timeslot; this.EpgTitle = BaseRecurringRecording.EPGTitle; this.ChannelHasIcon = BaseRecurringRecording.ChannelName == "All Channels" || (BaseRecurringRecording.Channel != null && BaseRecurringRecording.Channel.Icon != null); if (OnlyNewEpisodes && !this.Timeslot && DayMask == NUtility.DayMask.ANY && ChannelOid > 0) this.Type = RecordingType.Record_Season_New_This_Channel; else if (!OnlyNewEpisodes && !this.Timeslot && DayMask == NUtility.DayMask.ANY && ChannelOid > 0) this.Type = RecordingType.Record_Season_All_This_Channel; else if (this.Timeslot && DayMask == NUtility.DayMask.ANY && ChannelOid > 0) this.Type = RecordingType.Record_Season_Daily_This_Timeslot; else if (this.Timeslot && ChannelOid > 0 && ((int)this.DayMask & ((int)this.DayMask - 1)) == 0) // make sure only 1 day is set, by checking daymask is a power of 2 this.Type = RecordingType.Record_Season_Weekly_This_Timeslot; else if (this.Timeslot && ChannelOid > 0 && this.DayMask == (NUtility.DayMask.MONDAY | NUtility.DayMask.TUESDAY | NUtility.DayMask.WEDNESDAY | NUtility.DayMask.THURSDAY | NUtility.DayMask.FRIDAY)) this.Type = RecordingType.Record_Season_Weekdays_This_Timeslot; else if (this.Timeslot && ChannelOid > 0 && this.DayMask == (NUtility.DayMask.SATURDAY | NUtility.DayMask.SUNDAY)) this.Type = RecordingType.Record_Season_Weekends_This_Timeslot; else if (!this.Timeslot && this.ChannelOid == 0 && this.DayMask == NUtility.DayMask.ANY && !this.OnlyNewEpisodes) this.Type = RecordingType.Record_Season_All_Episodes_All_Channels; }
public static RecordingType GetRecordingType(NUtility.RecurringRecording RecurringRecording) { // put most specific at top if (RecurringRecording.OnlyNewEpisodes == false && RecurringRecording.Timeslot && RecurringRecording.DayMask == (DayMask.MONDAY | DayMask.TUESDAY | DayMask.WEDNESDAY | DayMask.THURSDAY | DayMask.FRIDAY)) return RecordingType.Record_Season_Weekdays_This_Timeslot; if (RecurringRecording.OnlyNewEpisodes == false && RecurringRecording.Timeslot && RecurringRecording.DayMask == (DayMask.SATURDAY | DayMask.SUNDAY)) return RecordingType.Record_Season_Weekends_This_Timeslot; if (RecurringRecording.OnlyNewEpisodes && RecurringRecording.Timeslot && ((((int)RecurringRecording.DayMask) & (((int)RecurringRecording.DayMask) - 1)) == 0)) return RecordingType.Record_Season_Weekly_This_Timeslot; if (RecurringRecording.OnlyNewEpisodes && RecurringRecording.Timeslot == false && RecurringRecording.DayMask == DayMask.ANY && RecurringRecording.ChannelOID == 0) return RecordingType.Record_Season_All_Episodes_All_Channels; if (RecurringRecording.OnlyNewEpisodes && RecurringRecording.Timeslot == false && RecurringRecording.DayMask == NUtility.DayMask.ANY) return RecordingType.Record_Season_New_This_Channel; if (RecurringRecording.OnlyNewEpisodes == false && RecurringRecording.Timeslot == false && RecurringRecording.DayMask == NUtility.DayMask.ANY) return RecordingType.Record_Season_All_This_Channel; if (RecurringRecording.OnlyNewEpisodes == false && RecurringRecording.Timeslot == true && RecurringRecording.DayMask == NUtility.DayMask.ANY) return RecordingType.Record_Season_Daily_This_Timeslot; return RecordingType.Record_Once; // unknown assume once }
private Models.EpgListing GetListingToRecord(NUtility.DayMask DayMask = NUtility.DayMask.ANY) { var controller = base.LoadController<NextPvrWebConsole.Controllers.Api.GuideController>(User); DateTime date = DateTime.Now.AddDays(1); switch (DayMask) { case NUtility.DayMask.MONDAY: date = date.Next(DayOfWeek.Monday); break; case NUtility.DayMask.TUESDAY: date = date.Next(DayOfWeek.Tuesday); break; case NUtility.DayMask.WEDNESDAY: date = date.Next(DayOfWeek.Wednesday); break; case NUtility.DayMask.THURSDAY: date = date.Next(DayOfWeek.Thursday); break; case NUtility.DayMask.FRIDAY: date = date.Next(DayOfWeek.Friday); break; case NUtility.DayMask.SATURDAY: date = date.Next(DayOfWeek.Saturday); break; case NUtility.DayMask.SUNDAY: date = date.Next(DayOfWeek.Sunday); break; case NUtility.DayMask.SATURDAY | NUtility.DayMask.SUNDAY: if (date.DayOfWeek != DayOfWeek.Sunday) { date = date.Next(DayOfWeek.Saturday); } break; case NUtility.DayMask.MONDAY | NUtility.DayMask.TUESDAY | NUtility.DayMask.WEDNESDAY | NUtility.DayMask.THURSDAY | NUtility.DayMask.FRIDAY: if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday) { date = date.Next(DayOfWeek.Monday); } break; } var listings = Models.ChannelGroup.LoadAll(User.Oid, false) .Take(1) .SelectMany(x => controller.Get(date, x.Name)) .SelectMany(x => x.Listings) .OrderByDescending(x => x.StartTime) .ToList(); var listing = listings.Where(x => x.StartTime > DateTime.UtcNow.AddMinutes(15)) .OrderBy(x => Guid.NewGuid()) // random order .FirstOrDefault(); return listing; }