示例#1
0
        private void btnSaveStats_Click(object sender, EventArgs e)
        {
            int playerindex = drpPlayers.SelectedIndex;

            BasketballPlayerGameStat _stats = new BasketballPlayerGameStat();

            _stats.PlayerName          = drpPlayers.Text;
            _stats.FieldGoalsAttempted = int.Parse(txtFGAtt.Text);
            _stats.FieldGoalsMade      = int.Parse(txtFGMade.Text);
            _stats.FreeThrowAttempts   = int.Parse(txtFTAtt.Text);
            _stats.FreeThrowsMade      = int.Parse(txtFTMade.Text);
            _stats.PersonalFouls       = int.Parse(txtFoulPersonal.Text);
            _stats.TechnicalFouls      = int.Parse(txtFoulTechnical.Text);

            lstStats.Add(_stats);


            // 2. clear the text boxes when done
            txtFGAtt.Text         = "";
            txtFGMade.Text        = "";
            txtFTAtt.Text         = "";
            txtFTMade.Text        = "";
            txtFoulPersonal.Text  = "";
            txtFoulTechnical.Text = "";

            // 3.  Show the new stats in the table.
            UpdateStatsTable();

            BasketballPlayerGameStatManager.SerializeList(lstStats);
        }
示例#2
0
        private void dgStats_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                if (e.ColumnIndex == 1)
                {
                    lstStats[e.RowIndex].FieldGoalsAttempted = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
                else if (e.ColumnIndex == 2)
                {
                    lstStats[e.RowIndex].FieldGoalsMade = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
                else if (e.ColumnIndex == 3)
                {
                    lstStats[e.RowIndex].FreeThrowAttempts = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
                else if (e.ColumnIndex == 4)
                {
                    lstStats[e.RowIndex].FreeThrowsMade = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
                else if (e.ColumnIndex == 6)
                {
                    lstStats[e.RowIndex].PersonalFouls = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }
                else if (e.ColumnIndex == 7)
                {
                    lstStats[e.RowIndex].TechnicalFouls = int.Parse(dgStats.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                }

                BasketballPlayerGameStatManager.SerializeList(lstStats);
            }
        }
示例#3
0
        private void dgStats_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            int row = e.Row.Index;

            lstStats.RemoveAt(row);
            BasketballPlayerGameStatManager.SerializeList(lstStats);
        }
示例#4
0
 private void GetSavedStats()
 {
     lstStats = BasketballPlayerGameStatManager.DeserializeList();
     UpdateStatsTable();
 }