Beispiel #1
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            DateTime date = dateTimePicker1.Value;

            listBox1.Items.Clear();
            try
            {
                Models.Matchup    nhl   = new Models.Matchup(date);
                Models.GameData[] games = nhl.games;
                listBox1.Items.AddRange(games);
            } catch { listBox1.Items.Add("There are no games to display on this date."); }
        }
Beispiel #2
0
        }    //listbox_selectedIndexChanged

        private void Form1_Load(object sender, EventArgs e)
        {
            AutoSize              = true;
            AutoSizeMode          = AutoSizeMode.GrowAndShrink;
            dateTimePicker1.Value = DateTime.Today;

            DateTime date = dateTimePicker1.Value;

            try
            {
                Models.Matchup    nhl   = new Models.Matchup(date);
                Models.GameData[] games = nhl.games;
                listBox1.Items.AddRange(games);
            }
            catch {}
        }
Beispiel #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DateTime date = dateTimePicker1.Value;
            string   curItem;

            Models.Matchup     nhl   = new Models.Matchup(date);
            Models.GameData[]  games = nhl.games;
            Models.GameSettler settle;
            Models.GameData    curObject = null;
            bool   isGame = false;
            string aStr;

            try
            {
                curItem = listBox1.SelectedItem.ToString();

                foreach (Models.GameData game in games)
                {
                    curObject = game;
                    if (game.ToString().Equals(curItem))
                    {
                        isGame = true;
                        break;
                    }
                }//for
                settle = new Models.GameSettler(curObject);
                if (isGame)
                {
                    aStr = settle.ToString();
                }
                else
                {
                    aStr = "There is nothing to display yet.";
                }
                label1.Text = aStr;
            }//try
            catch { }
        }    //listbox_selectedIndexChanged
        /// <summary>
        /// Constructor for the Daily Settler
        /// </summary>
        /// <param name="inDate">takes the date as a parameter to calculate which day is being settled</param>
        public DailySettler(DateTime inDate)
        {
            date = inDate;
            Matchup nhl = new Matchup(date);

            games = nhl.games;

            isComplete = true;
            foreach (GameData game in games)
            {
                if (game.abstractGameState != "Final")
                {
                    isComplete = false;
                    break;
                }
            }//for

            homes      = homeTotal();
            aways      = awayTotal();
            homesAways = homes - aways;
            awaysHomes = -homesAways;
            totalGoals = homes + aways;
        }//constructor