From f5121ef81a13b5076785cc25531a65860cd326b9 Mon Sep 17 00:00:00 2001 From: James Schafer Date: Sat, 10 Jun 2017 18:23:14 -0400 Subject: [PATCH] Implemented the TheaterScheduleHasUpdated Function in the Melody49Notifier --- Melody49Notifier/Melody49Notifier.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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)