コード例 #1
0
        /// <summary>
        /// This method handles the click event of the update button
        /// </summary>
        /// <param name="sender">
        /// Object that called the method
        /// </param>
        /// <param name="e">
        /// Event arguments
        /// </param>
        private void CmdUpdate_Click(object sender, RoutedEventArgs e)
        {
            // Get the selected player's ID number
            ListBoxItem lstPlayer = (ListBoxItem)lstPlayers.SelectedItem;

            // Create variables to hold input statistics
            int dA, dBB, dCS, dE, dH, dHBP, dHR, dO, dPA, dPO, dROE, dSBA, dSO, W, L;

            // Assign input statistics to corresponding variable
            dA   = int.Parse(txtStats [0].Text);
            dBB  = int.Parse(txtStats [1].Text);
            dCS  = int.Parse(txtStats [2].Text);
            dE   = int.Parse(txtStats [5].Text);
            dH   = int.Parse(txtStats [7].Text);
            dHBP = int.Parse(txtStats [8].Text);
            dHR  = int.Parse(txtStats [9].Text);
            dO   = int.Parse(txtStats [11].Text);
            dPA  = int.Parse(txtStats [12].Text);
            dPO  = int.Parse(txtStats [13].Text);
            dROE = int.Parse(txtStats [15].Text);
            dSBA = int.Parse(txtStats [16].Text);
            dSO  = int.Parse(txtStats [17].Text);
            W    = int.Parse(txtStats [19].Text);
            L    = int.Parse(txtStats [20].Text);

            // Insert defense statistics into database
            DataAccess.InsertDefenseStats((int)lstPlayer.Tag, dA, dBB, dCS, dE, dH, dHBP, dHR, dO, dPA, dPO, dROE, dSBA, dSO, W, L);

            // Call the CalculateStatistics constructor to perform the calculations
            CalculateStats.CalculateStatistics((int)lstPlayer.Tag);

            // Refresh statistics
            GetStats((int)lstPlayer.Tag);
        }
コード例 #2
0
        /// <summary>
        /// This method handles the click event of the update button
        /// </summary>
        /// <param name="sender">
        /// Object that called the method
        /// </param>
        /// <param name="e">
        /// Event arguments
        /// </param>
        private void CmdUpdate_Click(object sender, RoutedEventArgs e)
        {
            // Get the selected player's ID number
            ListBoxItem lstPlayer = (ListBoxItem)lstPlayers.SelectedItem;

            // Create variables to hold input statistics
            int o1B, o2B, o3B, oAO, oBB, oCS, oGO, oH, oHBP, oHR, oIBB, oPA, oROE, oSB, oSBA, oSF, oSH, oSO, W, L;

            // Assign input statistics to corresponding variable
            o1B  = int.Parse(txtStats [0].Text);
            o2B  = int.Parse(txtStats [1].Text);
            o3B  = int.Parse(txtStats [2].Text);
            oAO  = int.Parse(txtStats [4].Text);
            oBB  = int.Parse(txtStats [7].Text);
            oCS  = int.Parse(txtStats [9].Text);
            oGO  = int.Parse(txtStats [10].Text);
            oH   = int.Parse(txtStats [12].Text);
            oHBP = int.Parse(txtStats [13].Text);
            oHR  = int.Parse(txtStats [14].Text);
            oIBB = int.Parse(txtStats [16].Text);
            oPA  = int.Parse(txtStats [20].Text);
            oROE = int.Parse(txtStats [23].Text);
            oSB  = int.Parse(txtStats [24].Text);
            oSBA = int.Parse(txtStats [25].Text);
            oSF  = int.Parse(txtStats [27].Text);
            oSH  = int.Parse(txtStats [28].Text);
            oSO  = int.Parse(txtStats [30].Text);
            W    = int.Parse(txtStats [33].Text);
            L    = int.Parse(txtStats [34].Text);

            // Insert offense statistics into database
            DataAccess.InsertOffenseStats((int)lstPlayer.Tag, o1B, o2B, o3B, oAO, oBB, oCS, oGO, oH, oHBP, oHR, oIBB, oPA, oROE, oSB, oSBA, oSF, oSH, oSO, W, L);

            // Call the CalculateStatistics constructor to perform the calculations
            CalculateStats.CalculateStatistics((int)lstPlayer.Tag);

            // Refresh statistics
            GetStats((int)lstPlayer.Tag);
        }
コード例 #3
0
        /// <summary>
        /// This method handles the click event of the update button
        /// </summary>
        /// <param name="sender">
        /// Object that called the method
        /// </param>
        /// <param name="e">
        /// Event arguments
        /// </param>
        private void CmdUpdate_Click(object sender, RoutedEventArgs e)
        {
            // Get the selected player's ID number
            ListBoxItem lstPlayer = (ListBoxItem)lstPlayers.SelectedItem;

            // Create variables to hold input statistics
            int pBB, pER, pFB, pGB, pGS, pH, pIP, pIR, pIRA, pLD, pNP, pPA, pPU, pSO, pSV, pSVO, W, L;

            // Assign input statistics to corresponding variable
            pBB  = int.Parse(txtStats [0].Text);
            pER  = int.Parse(txtStats [2].Text);
            pFB  = int.Parse(txtStats [4].Text);
            pGB  = int.Parse(txtStats [6].Text);
            pGS  = int.Parse(txtStats [8].Text);
            pH   = int.Parse(txtStats [9].Text);
            pIP  = int.Parse(txtStats [11].Text);
            pIR  = int.Parse(txtStats [12].Text);
            pIRA = int.Parse(txtStats [13].Text);
            pLD  = int.Parse(txtStats [17].Text);
            pNP  = int.Parse(txtStats [19].Text);
            pPA  = int.Parse(txtStats [20].Text);
            pPU  = int.Parse(txtStats [22].Text);
            pSO  = int.Parse(txtStats [25].Text);
            pSV  = int.Parse(txtStats [26].Text);
            pSVO = int.Parse(txtStats [27].Text);
            W    = int.Parse(txtStats [30].Text);
            L    = int.Parse(txtStats [31].Text);

            // Insert pitching statistics into database
            DataAccess.InsertPitchingStats((int)lstPlayer.Tag, pBB, pER, pFB, pGB, pGS, pH, pIP, pIR, pIRA, pLD, pNP, pPA, pPU, pSO, pSV, pSVO, W, L);

            // Call the CalculateStatistics constructor to perform the calculations
            CalculateStats.CalculateStatistics((int)lstPlayer.Tag);

            // Refresh statistics
            GetStats((int)lstPlayer.Tag);
        }