protected override void OnActionExecuting(ActionExecutingContext filterContext) { CurrentUser = db.CurrentUser; CurrentWeek = db.CurrentWeek; CurrentWeekNumber = CurrentWeek == null ? (int?)null : CurrentWeek.WeekNumber; ViewBag.CurrentUser = CurrentUser; ViewBag.CurrentWeek = CurrentWeek; ViewBag.CurrentWeekNumber = CurrentWeekNumber; base.OnActionExecuting(filterContext); }
public static bool CheckWeekReminders(Week week) { bool retval = false; List<User> goons = null; if (!week.CutoffReminder && Helpers.Now.AddDays(1) >= week.CutoffDate) { if (!retval) { retval = true; goons = getGoons(week.WeekNumber); if (goons.Count > 0) SendEmail(goons, "Reminder: Enter Your Picks", "The cutoff for week " + week.WeekNumber.ToString() + " is " + week.CutoffDate.ToLongDateString() + " at " + week.CutoffDate.ToLongTimeString() + "<br><br>" + HttpContext.Current.Request.Url.AbsoluteUri.Replace("/Admin", "")); } week.CutoffReminder = true; } DateTime firstGame = week.Games.Min(g => g.GameDate); if (!week.FirstGameReminder && Helpers.Now.AddDays(1) >= firstGame) { if (!retval) { retval = true; goons = getGoons(week.WeekNumber); if (goons.Count > 0) SendEmail(goons, "Reminder: Enter Your Picks", "The first game of week " + week.WeekNumber.ToString() + " is " + firstGame.ToLongDateString() + " at " + firstGame.ToLongTimeString() + "<br><br>" + HttpContext.Current.Request.Url.AbsoluteUri.Replace("/Admin", "")); } week.FirstGameReminder = true; } return retval; }