Exemple #1
0
        /// <summary>
        /// shows finalized matches in a data grid
        /// </summary>
        /// <param name="MatchList"></param>
        /// <param name="dataGridView1"></param>
        void DisplayMatches(/*List<Match> MatchList, DataGridView dataGridView1*/)
        {
            dataGridView1.Columns.Clear();
            dataGridView1.ColumnCount           = 3;
            dataGridView1.Columns[0].HeaderText = "Big:";
            dataGridView1.Columns[1].HeaderText = "Little:";
            dataGridView1.Columns[2].HeaderText = "Match Rank:";

            int AvgRank = 0;

            foreach (Match m in Matched)
            {
                AvgRank += m.matchRating;

                string[] row = { m.Brother.FullName, m.Pledge.FullName, "" + m.matchRating };
                dataGridView1.Rows.Add(row);
            }
            //AvgRank /= MatchList.Count;
            string[] AverageRank = { "", "Average Ranking: ", "" + ((double)AvgRank) / ((double)Matched.Count) };
            dataGridView1.Rows.Insert(0, AverageRank);

            //write list of unmatched brothers to datagrid2
            dataGridView2.Columns.Clear();
            dataGridView2.ColumnCount           = 6;
            dataGridView2.Columns[0].HeaderText = "Remaining Brothers:";
            dataGridView2.Columns[1].HeaderText = "Choice 1: ";
            dataGridView2.Columns[2].HeaderText = "Choice 2: ";
            dataGridView2.Columns[3].HeaderText = "Choice 3: ";
            dataGridView2.Columns[4].HeaderText = "Choice 4: ";
            dataGridView2.Columns[5].HeaderText = "Choice 5: ";
            foreach (BrotherObject b in Brothers)
            {
                if (Matched.Exists(m => m.Brother.FullName == b.FullName) == false)
                {
                    string[] row = new string[6];
                    row[0] = b.FullName;
                    for (int i = 0; i < 5; i++)
                    {
                        row[i + 1] = (b.LittleChoices[i] != null) ? b.LittleChoices[i] : "";
                    }
                    dataGridView2.Rows.Add(row);
                }
            }
        }