Пример #1
0
        /// <summary>
        /// set mygame attributes to selected game
        /// </summary>
        private void Set_Game_Attributes()
        {
            // set team name and id if a team is selected
            if (GamesDG.SelectedItems.Count == 1)
            {
                DataRowView item = (DataRowView)GamesDG.SelectedItem;

                // parse game id from selected game
                int id = Int32.Parse(item["id"].ToString());

                // get game attributes from qry by id
                string qry = string.Format(SELECT_GAME_QRY, id);
                myGame.Set_Attributes(build.Execute_DataSet_Query(qry));
            }
        }
Пример #2
0
        /// <summary>
        /// updates information in database
        /// </summary>
        private void Update_Game()
        {
            // get game info from window uesr input
            string oppTeam  = OppNameTB.Text.ToString();
            string gameType = GameTypeCB.Text.ToString();
            string gameLoc  = GameLocCB.Text.ToString();
            string gameDate = string.Format(DATE_FMT, YearTB.Text.ToString(), MonthCB.Text.ToString(), DayCB.Text.ToString());

            // insert new game into game datatable
            string insqry = string.Format(UPDATE_GAME_QRY, oppTeam, gameType, gameLoc, gameDate, myGame.GetId());

            build.Execute_Query(insqry);

            // select inserted game from datatable
            myGame.init();
            myGame.Set_Attributes(build.Execute_DataSet_Query(SELECT_GAME_QRY));
        }