diff --git a/Melody49Notifier/Melody49Notifier.cs b/Melody49Notifier/Melody49Notifier.cs index 4095471..fe5251f 100644 --- a/Melody49Notifier/Melody49Notifier.cs +++ b/Melody49Notifier/Melody49Notifier.cs @@ -24,7 +24,23 @@ public static void Run([TimerTrigger("0/10 * * * * *")]TimerInfo myTimer, TraceW private static bool TheaterScheduleHasUpdated(TraceWriter log, out TheaterSchedule currentTheaterSchedule) { - throw new NotImplementedException(); + ICurrentTheaterScheduleDataFileManager currentTheaterScheduleDataFileManager = new CurrentTheaterScheduleDataFileManager(log); + ICurrentTheaterScheduleWebRequestManager currentTheaterScheduleWebRequestManager = null; + ITheaterScheduleComparer theaterScheduleComparer = null; + + TheaterSchedule currentTheaterScheduleFromFile = currentTheaterScheduleDataFileManager.SelectCurrentTheaterSchedule(); + TheaterSchedule currentTheaterScheduleFromWebSite = currentTheaterScheduleWebRequestManager.GetCurrentTheaterSchedule(); + + currentTheaterSchedule = currentTheaterScheduleFromWebSite; + + if (!theaterScheduleComparer.AreEqual(currentTheaterScheduleFromFile, currentTheaterScheduleFromWebSite)) + { + currentTheaterScheduleDataFileManager.UpdateCurrentTheaterSchedule(currentTheaterScheduleFromWebSite); + + return false; + } + + return true; } private static void SendNotification(TraceWriter log, TheaterSchedule currentTheaterSchedule)