Пример #1
0
        public static string GetLatestRace()
        {
            BuildRaceInfo();
            if (mRaces == null || mRaces.Count <= 0)
            {
                return(String.Empty);
            }
            RaceInfo latest = null;
            DateTime now    = DateTime.Now;

            foreach (RaceInfo race in mRaces)
            {
                if (race == null)
                {
                    continue;
                }
                if (race.RaceDate > now)
                {
                    continue;
                }
                if (latest == null || race.RaceDate > latest.RaceDate)
                {
                    latest = race;
                }
            }
            if (latest != null)
            {
                return(latest.Name);
            }
            return(String.Empty);
        }
Пример #2
0
        public static void BuildRaceInfo()
        {
            if (mRaces != null)
            {
                return;
            }
            // Set these up so we can notify the user that the race's
            // data isn't currently set.
            if (int.TryParse(AgeGradingForm.kYear, out _currentYear))
            {
                _nextYear   = _currentYear + 1;
                UNKNOWNDATE = $"1/1/{_nextYear}";
            }
            mRaces = new List <RaceInfo>();
            RaceInfo raceInfo = null;

            raceInfo = new RaceInfo(kDefaultRaceName, 5.0000000, 0.0, DateTime.Parse("01/01/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("War Party 10K", 10.0000000, 0.0, DateTime.Parse("02/20/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Surgoinsville 10 Miler", 16.0934400, 10.0, DateTime.Parse("10/16/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Virginia Creeper 10 Miler", 16.0934400, 10.0, DateTime.Parse("05/08/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Mendota 5K River Run", 5.0000000, 0.0, DateTime.Parse("03/11/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("5K Run for St Anne School", 5.0000000, 0.0, DateTime.Parse("05/13/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Chasing Snakes 10K", 10.0000000, 0.0, DateTime.Parse("03/18/21")); mRaces.Add(raceInfo);
            // raceInfo = new RaceInfo("Laurel Run Ascent", 17.7027840, 11.0, DateTime.Parse("4/13/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Run the Tunnel", 6.1155072, 3.8, DateTime.Parse("4/24/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Amis Mill 10K", 10.0000000, 0.0, DateTime.Parse("05/11/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Justin Foundation 5K", 5.0000000, 0.0, DateTime.Parse("5/21/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("CASA 8K", 8.0000000, 0.0, DateTime.Parse("6/4/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("River Mile", 1.6093440, 1.0, DateTime.Parse("06/04/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Phipps Bend River Run", 0.0, 10.0, DateTime.Parse("10/12/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Mountain States Rehab 5K", 5.0000000, 0.0, DateTime.Parse("06/17/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Varmint Half Marathon", 21.0824064, 13.1, DateTime.Parse("6/8/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Crooked River Half Marathon", 21.0824064, 13.1, DateTime.Parse("10/15/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Rhododendron 10K", 10.0000000, 0.0, DateTime.Parse("6/22/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Firecracker 4 miler", 6.4373760, 4.0, DateTime.Parse(UNKNOWNDATE)); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Red, White & Boom 4 Miler", 6.4373760, 4.0, DateTime.Parse("7/4/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Crazy 8s 8K", 8.0000000, 0.0, DateTime.Parse("7/13/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Wolf Run 7 Miler", 11.2654080, 7.0, DateTime.Parse("7/16/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Railroad Days 5K", 5.0000000, 0.0, DateTime.Parse("8/07/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Schoolhouse 5K", 5.0000000, 0.0, DateTime.Parse(UNKNOWNDATE)); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Christopher Todd Richardson Memorial 10k", 10.0000000, 0.0, DateTime.Parse(UNKNOWNDATE)); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Greene County YMCA 5K", 5.0000000, 0.0, DateTime.Parse("8/17/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Eastman 10K", 10.0000000, 0.0, DateTime.Parse("9/9/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Baileyton Celebration 5K", 5.0000000, 0.0, DateTime.Parse("9/11/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Bays Mountain Trail Race", 24.1401600, 15.0, DateTime.Parse("9/14/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Rhythm & Roots 5K", 5.0000000, 0.0, DateTime.Parse("9/11/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Apple Festival 4 Miler", 6.4373760, 4.0, DateTime.Parse("10/02/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Just For Fun 5K", 5.0000000, 0.0, DateTime.Parse("3/16/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Restore Your Sole 5K", 5.0000000, 0.0, DateTime.Parse("5/1/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("NCH Heart-One Cardiac Rehab 5K Run", 5.0000000, 0.0, DateTime.Parse("10/12/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Run Fur Their Lives 5K", 5.0000000, 0.0, DateTime.Parse("10/06/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Run Fur Their Lives 10K", 10.0000000, 0.0, DateTime.Parse("10/06/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Roan Mountain 10K", 10.0000000, 0.0, DateTime.Parse("11/06/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Tri-Cities Race for the Cure 5K", 5.0000000, 0.0, DateTime.Parse("10/13/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Haunted Half Marathon", 21.0824064, 13.1, DateTime.Parse("10/30/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("BAE Veterans Day Classic Half Marathon", 21.0824064, 13.1, DateTime.Parse("11/9/21")); mRaces.Add(raceInfo);
            //raceInfo = new RaceInfo("Santa Special Open Mile", 1.6093440, 1.0, DateTime.Parse("11/19/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Johnson City Turkey Trot 5K (Up & At 'Em)", 5.0000000, 0.0, DateTime.Parse("11/25/21")); mRaces.Add(raceInfo);
            raceInfo = new RaceInfo("Pioneer 5 Miler", 8.0467200, 5.0, DateTime.Parse("12/18/21")); mRaces.Add(raceInfo);
            mRaces.Sort(new RaceInfoComparer());
            double totalKilometers = 0;
            double totalMiles      = 0;

            foreach (RaceInfo item in mRaces)
            {
                totalKilometers += item.GetKilometers();
                totalMiles      += item.GetMiles();
            }
            Debug.WriteLine(String.Format("Miles = {0} Kilometers = {1}", totalMiles, totalKilometers));
#if SHOW_SORTED_LIST
            foreach (RaceInfo info in mRaces)
            {
                Debug.WriteLine(info.Name);
            }
#endif
        }