/* * Creates the table with next run highligted. It displays up to 3 months of "future races" schedule */ public WeeklyRun displayNextRunsOnTable() { //1. today's date DateTime today = DateTime.Now; //today = new DateTime(2013, 11, 20); //myDate = new DateTime(2012, 6, 15); //2. derive next saturdays' date from today DateTime nextRunDate = new DateTime(today.Year, today.Month, 1); //holder date - used to control how for in the future print schedule DateTime holderTime = nextRunDate; holderTime = holderTime.Date.AddMonths(MAX_NUMBER_OF_MONTHS); //Check if today is a Saturday. If so, today is the day of the run and there is nothing to be done. //Otherwise, move the day up to next Saturday if (!(this.isTheRunToday(today))) { int dayOfWeek = this.getDayOfWeekInt(today); //shift days of week until Saturday today = today.Date.AddDays(7 - dayOfWeek); } //Check if 1st day of month is a Saturday. If so, today is the day of the run and there is nothign to be done //Otherwise, move the day up to Next Saturday if (!(this.isTheRunToday(nextRunDate))) { int dayOfWeek = this.getDayOfWeekInt(nextRunDate); //shift days of week until Saturday nextRunDate = nextRunDate.Date.AddDays(7 - dayOfWeek); } int weekNumber = 1; //Used to keep track of when we are starting a new month int tempMonth = nextRunDate.Month; int counter = 0; //Runs for as long as the range of dates is not reached while (holderTime > nextRunDate) { //we rolled into a new month if (tempMonth != nextRunDate.Month) { weekNumber = 1; tempMonth = nextRunDate.Month; counter++; } //end if if (counter == 3) { counter = 0; } WeeklyRun wr = this.getNextLocation(weekNumber, nextRunDate); if (today.Day.Equals(nextRunDate.Day) && today.Month.Equals(nextRunDate.Month)) { //Save the location for weather forecast this.currentLocation = wr.RunName; currentLocationRun = wr; } weekNumber++; //increase the date by a week nextRunDate = nextRunDate.Date.AddDays(7); } return currentLocationRun;//currentLocation; //.ToString(); }
/* * Makes the directions visible */ protected void enableDirection(WeeklyRun run) { /*if (run == WeeklyRun.ALAMEDA) this.Alameda.Visible = true; else if (run == WeeklyRun.LAKE_MERRIT) this.LakeMerrit.Visible = true; else if (run == WeeklyRun.EMERYVILLE) this.Emeryville.Visible = true; else if (run == WeeklyRun.SAN_LEANDRO) this.SanLeandro.Visible = true; else if (run == WeeklyRun.STRAWBERRY_CANYON) this.StrawberryCanyon.Visible = true; else if (run == WeeklyRun.LAFAYETE) this.Lafayette_WC.Visible = true; else if (run == WeeklyRun.LAKE_CHABOT) this.LakeChabot.Visible = true; */ }