/** * * <summary> * This method gets the basketball data from database * </summary> * @method GetBasketballData * * @returns {void} */ protected void GetBasketballData() { int GameID = Convert.ToInt32(Request.QueryString["GAMEID"]); using (GameConnection db = new GameConnection()) { GAMES updatedrecord = (from gc in db.GAMES where gc.GAMEID == GameID select gc).FirstOrDefault(); if (updatedrecord != null) { GameNameTextBox.Text = updatedrecord.GAMENAME; DescriptionTextBox.Text = updatedrecord.DESCRIPTION; SpectatorsTextBox.Text = updatedrecord.SPECTATORS.ToString(); TeamATextBox.Text = updatedrecord.TEAM_A; PointATextBox.Text = updatedrecord.TEAM_A_POINTS.ToString(); TeamBTextBox.Text = updatedrecord.TEAM_B; PointBTextBox.Text = updatedrecord.TEAM_B_POINTS.ToString(); PlayedOnTextBox.Text = updatedrecord.PLAYED_ON.ToString("yyy-MM-dd"); WinnerTextBox.Text = updatedrecord.WINNER; TotalPointsTextBox.Text = updatedrecord.TOTAL_POINTS.ToString(); } } }
/** * *<summary> * This method connects to db and displays soccer data. * </summary> * * @method GetSoccerData * @returns {void} */ protected void SoccerGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { //store the row which is clicked int selectedSoccerGame = e.RowIndex; //get the selected game id using soccer datakey int GAMEID = Convert.ToInt32(SoccerGridView.DataKeys[selectedSoccerGame].Values["GAMEID"]); // using ef to find the selected soccer game. using (GameConnection db = new GameConnection()) { //create object of games class and store the query GAMES deletedSoccerGame = (from soccerrecords in db.GAMES where soccerrecords.GAMEID == GAMEID select soccerrecords).FirstOrDefault(); //remove the selected cricket game from the db db.GAMES.Remove(deletedSoccerGame); // save my changes back to the database db.SaveChanges(); //refresh the grid this.GetSoccerData(); } }
/** * <summary> * This method saves the operation * </summary> * @method SaveButton_Click * @param {object} sender * @param {EventArgs} e * @returns {void} */ protected void SaveButton_Click(object sender, EventArgs e) { // Use EF to connect to the server using (GameConnection db = new GameConnection()) { // use the Game Tracker model to create a new basketball game object and // save a new record GAMES newGame = new GAMES(); int GameID = 0; if (Request.QueryString.Count > 0) // our URL has a GameID in it { // get the id from the URL GameID = Convert.ToInt32(Request.QueryString["GameID"]); // get the current basketball game from EF DB newGame = (from gc in db.GAMES where gc.GAMEID == GameID select gc).FirstOrDefault(); } // add form data to the new basketball game record newGame.GAMENAME = GameNameTextBox.Text; newGame.DESCRIPTION = DescriptionTextBox.Text; newGame.TEAM_A = TeamATextBox.Text; newGame.TEAM_B = TeamBTextBox.Text; newGame.TEAM_A_POINTS = Convert.ToInt32(PointATextBox.Text); newGame.TEAM_B_POINTS = Convert.ToInt32(PointBTextBox.Text); newGame.PLAYED_ON = Convert.ToDateTime(PlayedOnTextBox.Text); newGame.WINNER = WinnerTextBox.Text; newGame.TOTAL_POINTS = Convert.ToInt32(TotalPointsTextBox.Text); newGame.SPECTATORS = Convert.ToInt32(SpectatorsTextBox.Text); // use LINQ to ADO.NET to add / insert new basketball game into the database if (GameID == 0) { db.GAMES.Add(newGame); } // save our changes - also updates and inserts db.SaveChanges(); // Redirect back to the updated basketball page Response.Redirect("/Games/Basketball.aspx"); } }
private static void Main() { var output = new StringBuilder(); int remainingTestCases = int.Parse(Console.ReadLine()); while (remainingTestCases-- > 0) { output.Append( GAMES.Solve(decimal.Parse(Console.ReadLine()))); output.AppendLine(); } Console.Write(output); }
public static void init() { if (File.Exists(INIT.GAME_ROOT + "Morrowind.exe")) { CURRENT_GAME = GAMES.MASS; INIT.USER_DB_FILE = INIT.RES_DIR + "MASS.db"; INIT.DB_CONNECTION_STRING = "Data Source=" + INIT.USER_DB_FILE; INIT.GAME_ISO_MOUNT_PATH = INIT.CTRL_PANEL_DIR + "Morrowind.iso"; INIT.RUN_THROW_SCRIPT_EXTENDER = false; INIT.GAME_PROCESS_NAME = "Morrowind"; INIT.MASTER_FILES_ESM = new string[3]; UPDATE_DB_DOWNLOAD_LINK = ""; } else { if (File.Exists(INIT.GAME_ROOT + "Oblivion.exe")) { if (File.Exists(INIT.GAME_ROOT + @"Data\Morrowind_ob.esm")) { UPDATE_DB_DOWNLOAD_LINK = ""; CURRENT_GAME = GAMES.MP; INIT.USER_DB_FILE = INIT.RES_DIR + "MP.db"; INIT.DB_CONNECTION_STRING = "Data Source=" + INIT.USER_DB_FILE; INIT.RUN_THROW_SCRIPT_EXTENDER = true; INIT.GAME_PROCESS_NAME = "Oblivion"; INIT.MASTER_FILES_ESM = new string[2]; INIT.MASTER_FILES_ESM[0] = "Oblivion.esm"; INIT.MASTER_FILES_ESM[1] = "Morrowind_ob.esm"; } else { UPDATE_DB_DOWNLOAD_LINK = @"https://www.dropbox.com/s/k6lsypai1kwztcz/CP.db?dl=1"; CURRENT_GAME = GAMES.OP; INIT.USER_DB_FILE = INIT.RES_DIR + "OP.db"; INIT.DB_CONNECTION_STRING = "Data Source=" + INIT.USER_DB_FILE; INIT.RUN_THROW_SCRIPT_EXTENDER = true; INIT.GAME_PROCESS_NAME = "Oblivion"; INIT.MASTER_FILES_ESM = new string[1]; INIT.MASTER_FILES_ESM[0] = "Oblivion.esm"; } } else { if (File.Exists(INIT.GAME_ROOT + "SkyrimSE.exe")) { resolutionItemChangeWithCopyUIFixes = true; UPDATE_DB_DOWNLOAD_LINK = @"https://www.dropbox.com/s/295t2xi7mx3652v/ESSE.db?dl=1"; activepluginsMarkAsterisk = true; CURRENT_GAME = GAMES.ESSE; INIT.USER_DB_FILE = INIT.RES_DIR + "ESSE.db"; INIT.DB_CONNECTION_STRING = "Data Source=" + INIT.USER_DB_FILE; INIT.RUN_THROW_SCRIPT_EXTENDER = false; INIT.GAME_PROCESS_NAME = "SkyrimSE"; INIT.MASTER_FILES_ESM = new string[5]; INIT.MASTER_FILES_ESM[0] = "Skyrim.esm"; INIT.MASTER_FILES_ESM[1] = "Update.esm"; INIT.MASTER_FILES_ESM[2] = "Dawnguard.esm"; INIT.MASTER_FILES_ESM[3] = "HearthFires.esm"; INIT.MASTER_FILES_ESM[4] = "Dragonborn.esm"; } else { throw new GameTypeInitializationException(); } } } }