Exemple #1
0
        /*------------ TEAM HELPER METHODS --------------- */

        /// <summary>
        /// takes user to the team editor window
        /// </summary>
        private void Edit_Team()
        {
            // check if a team is selected
            EditTeamWindow atw = new EditTeamWindow(this, myTeam, myPlayer, build);

            atw.Show();
            this.Hide();
        }
        /// <summary>
        /// takes user to team editor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditTeamBTN_Click(object sender, RoutedEventArgs e)
        {
            // check if a team is selected
            if (myTeam.HasInfo())
            {
                EditTeamWindow atw = new EditTeamWindow(this, myTeam, myPlayer, build);
                atw.Show();
                this.Hide();
            }

            else
            {
                MessageBox.Show(SELECT_TEAM_MSG);
            }
        }
Exemple #3
0
        /* ------------- HELPER METHODS ------------ */
        /// <summary>
        /// fills myteam with attributes and stats and inserts into datatable
        /// navigates user to team editor of new team
        /// </summary>
        private void Create_Team()
        {
            if (Is_TB_Empty())
            {
                MessageBox.Show(FILL_TEXT_MSG);
                return;
            }

            // get teamname
            string teamName = TeamNameTB.Text.ToString();

            // ensure team year is formatted correctly then parse
            if (TeamYearTB1.Text.Length == 4 && TeamYearTB2.Text.Length == 4)
            {
                // format team year string
                string teamYear = TeamYearTB1.Text.ToString() + "-" + TeamYearTB2.Text.ToString();

                // add team to database
                AddTeam(teamName, teamYear);

                // get team info from data table
                string qry = string.Format(SELECT_RECENT_TEAM_QRY);

                // set team attributes from dataset
                myTeam.SetAttributes(build.Execute_DataSet_Query(qry));

                // navigate user to team editor of new team
                EditTeamWindow etw = new EditTeamWindow(mainWindow, myTeam, mainWindow.GetMyPlayer(), build);
                etw.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show(YEAR_FORMAT_MSG);
            }
        }